Tumblr
Moved to tumblr: http://urlencode.tumblr.com/
Blog of Titus Stone; Part programmer, part... wait... what?
Moved to tumblr: http://urlencode.tumblr.com/
Posted by titus at 7:08 PM 0 comments
Labels: moved
Occasionally the situation comes up in web development where you have a highly styled tag such as
<div> or <li> that you want to make clickable. This often happens when you have a list of items in which you want to make the entire item clickble instead of just the title for example. The standard fare for doing so is to set { cursor: pointer; } with CSS then to bind the .click event to the tag (in jQuery as so)....
$('#myDivTag').click(function() { // your code here });
<style type="text/css"> #myDivWrapper { display: block; } #myDiv { } </style> <a id="myDivWrapper"> <div id="myDiv"> ... content ... </div> </a>
<style type="text/css"> #myDiv { position: relative; } a.clickable-overlay { position: absolute; top: 0; left: 0; height: 100%; width: 100%; z-index: 1; display: block; background-color: transparent; } </style> <div id="myDiv"> ... content ... <a class="clickable-overlay" href="#wherever"></a> </div>
Posted by titus at 6:44 AM 2 comments
mind.location = unknown
http://www.zazzle.com/javascript_mind_tshirt-235892961444457742
I wonder what the value of the variable unknown is?
import_soul
http://www.zazzle.com/import_soul_tshirt-235715645595867505
Posted by titus at 5:27 PM 0 comments
Labels: random
Well it's past midnight and I'm musing about web templating in Python for Tornado or AppEngine. The thing about most Python templating engines that I notice is...
Posted by titus at 8:20 PM 0 comments
Labels: template, web-frameworks
I like Komodo Edit. It's simple but at the same time functional enough to be useful. It also does code completion, supports Python, and is cross-platform. (Side note: If only it supported Scala, then it would be like the **aaaaahhh** perfect editor).
I've had this idea kicking around for a while of starting a Komodo color themes/schemes website. The idea is simple. You create a theme, then share it on the site. Other people can download it or Vote/"Like" it. Most-liked themes bubble to the top. I'm thinking of a simple architecture using Google App Engine (python) + Tornado. We'll see.
In the mean time I sure did waste like 2 hours of what should have been productive programming time putting together a bunch of themes for Komodo Edit. Here are some previews of them...
Posted by titus at 7:34 PM 3 comments
Labels: komodo-edit, komodo-themes
So it's midnight and I'm programming Scala (heh). I'm actually starting to be able to write little scripts in Scala. Here's a quick one that I put together, inspired by Chapter 3 of "Programming Scala" which reads a source code file and formats the file to the screen with line numbers.
I tried to be as functional as possible. The "formatSourceLine" I felt was getting close to the concept, using recursion, immutable values, and always returning a value (avoiding the side effect of printing from within the function).
The actual output from this script is:
D:\Development\Scala>scala file.scala file.scala 1 | import scala.io.Source 2 | 3 | if (args.length > 0) { 4 | 5 | def formatSourcePrefix(line: Int, suffix: String, max: Int = 5): 6 | var prefix: String = "" 7 | for (i <- 1 to (max - line.toString.length)) 8 | prefix += " " 9 | prefix + line.toString + suffix 10 | } 11 | 12 | def formatSourceLine(lines: List[String], line: Int = 1, 13 | val out = output + formatSourcePrefix(line, " | ") 14 | if (lines.length > 1) 15 | formatSourceLine(lines.tail, line + 1, out) 16 | else 17 | out 18 | } 19 | 20 | // Read file from disk 21 | val lines = Source.fromPath(args(0)).getLines().toList 22 | 23 | // Print results to screen 24 | println 25 | print(formatSourceLine(lines)) 26 | 27 | } 28 | else { 29 | // Print out proper syntax 30 | Console.err.println 31 | Console.err.println("scala file.scala [filename]") 32 | }
Posted by titus at 11:58 PM 1 comments
Labels: functional-programming, scala
How can you print the string value of a floating point value of 5 in Scala?
scala> 5.toString // Wrong! res16: java.lang.String = 5 scala> 5. toString res17: java.lang.String = 5.0
scala> 4.+(1) res20: Double = 5.0 scala> 4 .+(1) res21: Int = 5
Posted by titus at 11:05 AM 1 comments
Labels: scala
© Blogger template 'Minimalist G' by Ourblogtemplates.com 2008
Back to TOP