This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function lambda() { | |
if(func_num_args() > 1) { | |
$func = func_get_arg(1); | |
if($func[strlen($func)-1] != ';') | |
$func = $func.';'; | |
return create_function(func_get_arg(0), 'return '.$func); | |
} else { | |
$func = func_get_arg(0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include 'functional.php'; | |
mail( | |
"[email protected]", | |
"Simplerochester.com Submission", | |
implode( | |
"\n", | |
map( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def bit | |
"%0160b" % to_i(16) | |
end | |
def distance(word1, word2) | |
word1, word2 = word1.bit, word2.bit | |
distance = 0 | |
word1.chars.zip(word2.chars) do |char1, char2| | |
puts "#{char1} | #{char2}" | |
distance += 1 unless char1 == char2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'json' | |
# given a components directory, poop a components.js to stdout | |
raise(ArgumentError, "target dir is required") unless cdir = ARGV[0] | |
exts = ["css", "html", "js", "res"] | |
puts "jQuery.golf.components="+Hash[*exts.collect{|e| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.actors.Actor | |
import scala.actors.Actor._ | |
import java.net.{InetAddress,ServerSocket,Socket,SocketException} | |
import java.io._ | |
import scala.xml._ | |
//case classes | |
case class Request(s:Socket) | |
// actor definition |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def parseParams(path:String):Map[String,Array[String]] = { | |
for { | |
pair <- path.split('/').toList.tail.zipWithIndex.filter(part => placeholders.exists(place => part._2 == place)) | |
} yield (parts(pair._2) -> Array(pair._1)) | |
} | |
//[error] /Users/alan/Projects/scala/step/./src/main/scala/Step.scala:34: type mismatch; | |
//[error] found : List[(String, Array[String])] | |
//[error] required: Map[String,Array[String]] | |
//[error] pair <- path.split('/').toList.tail.zipWithIndex.filter(part => placeholders.exists(place => part._2 == place)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function tableize(data, selector) { | |
return $("<table/>").append( | |
A(data).find(selector).map(function() { | |
var ret = "<tr/>"; | |
$.each(this, function(k,v) { ret += "<td>"+v+"</td>" }); | |
return ret + "</tr>"; | |
}).get().join("") | |
); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function tableize(wrapper, row, field, data, columns) { | |
return $("<"+wrapper+"/>").append( | |
A(data).map(function() { | |
var ret = $("<"+row+"/>"); | |
$.each($.map(this, function(prop) { | |
for(c in columns) { | |
if(columns[c] == prop) { | |
return prop; | |
} | |
} |
NewerOlder