This file contains 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
getstyles -> | |
result = {} | |
for key in arguments | |
result[key] = this.getStyle(key) | |
return result |
This file contains 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 coffee | |
# looking to generate something like: | |
# {"root":[{"name":"a","branches":[{"name":"aa"},{"name":"bb"}]},{"name":"b"},{"name":"c"}]} | |
fs = require 'fs' | |
Path = require 'path' | |
dir_tree = (path,name=null) -> | |
if not name |
This file contains 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 dt(path,name=nil) | |
if not name | |
data = {} | |
data[:root] = children = [] | |
else | |
data = {:name => name } | |
data[:branches] = children = [] | |
end | |
dirs = []; files = [] |
This file contains 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
require 'rubygems' | |
require 'em-websocket' | |
require 'json' | |
require 'open4' | |
EventMachine.run { | |
EventMachine::WebSocket.start(:host => "0.0.0.0", :port => 4452) do |ws| | |
ws.onopen { | |
puts "WebSocket connection open" |
This file contains 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
# Ubuntu Raring | |
# Version 0.1 | |
FROM ubuntu:12.10 | |
# https://github.com/dotcloud/docker/issues/1024 | |
run dpkg-divert --local --rename --add /sbin/initctl | |
run cp /bin/true /sbin/initctl | |
# these resources helped... | |
# http://askubuntu.com/questions/250733/can-i-do-a-silent-or-unattended-release-upgrade |
This file contains 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
from scratch | |
add http://cdimage.ubuntu.com/ubuntu-core/releases/13.04/release/ubuntu-core-13.04-core-amd64.tar.gz / | |
version raring | |
version 13.04 | |
# lxc-start: No such file or directory - failed to mount 'proc' on '/usr/lib/x86_64-linux-gnu/lxc//proc' | |
# lxc-start: failed to setup the mount entries for 'ea0530624206181037ad33d02232a35eafe146b816df8dea446413795db2e842' | |
# lxc-start: failed to setup the container | |
# lxc-start: invalid sequence number 1. expected 2 | |
# lxc-start: failed to spawn 'ea0530624206181037ad33d02232a35eafe146b816df8dea446413795db2e842' |
This file contains 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
wget -O chruby-0.3.4.tar.gz https://github.com/postmodern/chruby/archive/v0.3.4.tar.gz | |
tar -xzvf chruby-0.3.4.tar.gz | |
cd chruby-0.3.4 | |
PREFIX=$HOME/chruby make install | |
echo 'source ~/chruby/share/chruby/chruby.sh' >> ~/.bash_login | |
git clone git://github.com/sstephenson/ruby-build.git ~/chruby-0.3.4/ruby-build | |
cd ~/chruby-0.3.4/ruby-build | |
PREFIX=$HOME/chruby ./install.sh | |
~/chruby/bin/ruby-build 2.0.0-p0 ~/.rubies/2.0.0-p0 | |
echo 'chruby 2.0.0-p0' >> ~/.bash_login |
This file contains 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
# can await be made to not return from function until it is done? | |
fs = require("fs") | |
readfile = (fn) -> | |
await fs.readFile fn, "utf8", defer(err,res) | |
#console.log "res: ", res | |
return res | |
a = readfile("dbtest.coffee") |
This file contains 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
#iced = require('iced-coffee-script').iced | |
fs = require("fs") | |
class T | |
constructor: (cb) -> | |
console.log "asdf" | |
await fs.readFile __filename, "utf8", defer(err,res) | |
cb(err,res) | |
module.exports = T |
This file contains 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
$ cat b.rb | |
array = (1..5_000_000).map { rand } | |
$ time ruby b.rb | |
real 0m0.911s | |
user 0m0.822s | |
sys 0m0.088s | |
$ cat b.ex | |
array = Enum.map (1..5_000_000), fn(_) -> :random.uniform end |
OlderNewer