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
Config { font = "xft:Noto Sans CJK SC:size=10:antialias=true" | |
, bgColor = "black" | |
, fgColor = "green" | |
, position = TopSize L 94 13 | |
, lowerOnStart = True | |
, commands = [ Run Network "eth0" [] 50 | |
, Run Cpu ["-L","3","-H","50","--normal","green","--high","red"] 50 | |
, Run Memory ["-t","Mem: <usedratio>%"] 50 | |
, Run Com "uname" ["-s","-r"] "" 36000 | |
, Run Date "%a %b %_d %Y %H:%M" "date" 50 |
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
# results differently in ruby 1.8 and 1.9 | |
require 'yaml' | |
class A; end | |
module B | |
class A | |
yaml_as "tag:ruby.yaml.org,2002:object:A" | |
end | |
end |
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 System.Environment | |
import Data.List | |
prime :: [Int] | |
prime = unfoldr (\(x:xs) -> Just (x, sieve x xs)) [2..] | |
prime' :: Int -> [Int] | |
prime' limit = unfoldr con [2..limit] where | |
con [] = Nothing | |
con (x:xs) = Just (x, sieve x xs) |
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
module Kernel | |
def method_missing(name, *args, &block) | |
if args[0].respond_to?(name) | |
args[0].send(name, *args[1..-1], &block) | |
else | |
super | |
end | |
end | |
end |
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
this.Module = (($) -> | |
value = 0 | |
pub = | |
init: -> | |
value = 10 | |
console.log("inited #{value}") | |
add: -> | |
value += 10 | |
console.log("value changed to #{value}") | |
)(jQuery) |
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
zombie = require("zombie") | |
assert = require("assert") | |
vows = require('vows') | |
vows.describe('vows of zombie').addBatch( | |
'when visit home page' : | |
topic : -> zombie.visit("http://localhost:3000", @callback) | |
'title should be correct' : (err, browser, status) -> | |
assert.equal(browser.text("title"), "Correct Title") |
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
generic_fib = -> a, b, &c { Enumerator.new{ |y| loop { y << a; a, b = b, c[a,b] }}} | |
fib = generic_fib[1,1, &:+] | |
negative_fib = generic_fib[1,-1, &:-] | |
p fib.take(10) | |
p negative_fib.take(10) |
NewerOlder