This plugin allows you to directly include HTML templates into a Javascript file.
Given the following template:
template.html
# This class implements async evaluation by transparently executing the block on a different thread. | |
class Future < Lazy | |
def initialize(&block) | |
@attribute = ::Lazy.new(&block) | |
@thread = ::Thread.new { @attribute.__send__(:__call__) } | |
end | |
private | |
def __call__ |
Array.prototype.unique = function() { | |
return this.filter(function(value, index, array) { | |
return array.indexOf(value) === index; | |
}); | |
} |
function curry(fn) { | |
var arity = fn.length, | |
args = Array.prototype.slice.call(arguments, 1); | |
function accumulator() { | |
var leftArgs = args.concat(Array.prototype.slice.call(arguments, 0)); | |
if (leftArgs.length >= arity) { | |
return fn.apply(this, leftArgs); | |
} else { |
#!/usr/bin/env ruby | |
require "webrick" | |
unless ARGV[0] | |
STDERR.puts "Usage: cgiup [PATH TO CGI SCRIPT]" | |
exit 1 | |
end | |
cgi_script = File.expand_path(ARGV[0]) |
def luminance(color = "FFFFFF") | |
r, g, b = color.chars.each_slice(2).map(&:join).map(&:hex) | |
r * 0.299 + g * 0.587 + b * 0.114 | |
end |
import static org.junit.Assert.*; | |
import java.util.Iterator; | |
import java.util.NoSuchElementException; | |
import org.junit.Before; | |
import org.junit.Test; | |
public class DequeTest { | |
private Deque<String> deque; |
(def fib-seq | |
((fn fib [a b] (cons a (lazy-seq (fib b (+ b a))))) 1 1)) |
require "rubygems" | |
require "ldap" | |
require "net/ldap" | |
email = "somemail@ibm.com" | |
password = "secret" | |
host = "bluepages.ibm.com" | |
treebase = "ou=bluepages, o=ibm.com" | |
filter = "(&(objectClass=person)(mail=#{email}))" |
# Classic approach | |
def check_for_truth | |
has_at_least_one_true = false # ewwww temp var | |
[false, false, true].each do |option| | |
has_at_least_one_true = option | |
end | |
has_at_least_one_true | |
end |