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 | |
express = require "express" | |
jade = require "jade" | |
assets = require "connect-assets" | |
stylus = require "stylus" | |
nib = require "nib" | |
fs = require "fs" | |
#routes = require './routes' | |
#user = require './routes/user' | |
http = require 'http' |
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
import javax.script.*; | |
public class GroovyScripting { | |
public static void main(String[] args) throws Exception { | |
ScriptEngine engine = new ScriptEngineManager().getEngineByName("groovy"); | |
Bindings bindings = engine.getBindings(ScriptContext.ENGINE_SCOPE); | |
bindings.put("counter", 0); | |
bindings.put("args", new String[] {"hello", "world"}); | |
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 bash | |
f() { | |
/etc/init.d/chef-expander $1 | |
/etc/init.d/chef-solr $1 | |
/etc/init.d/chef-server $1 | |
/etc/init.d/chef-server-webui $1 | |
} | |
if [ "$1" == "start" ]; then | |
f start | |
elif [ "$1" == "stop" ]; then |
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 expect | |
set user "your_username" | |
set prompt ".*$user.*" | |
set domain "subdomain.yourdomain.com" | |
set timeout 60 | |
if { $argc < 2 } { | |
puts "usage: $argv0 <public-key-absolute-path> <ssh-password> | |
Append a public key to ~/.ssh/authorized_keys of $user@$domain | |
ex) $ ./append-publickey.exp /home/foobar/.ssh/id_rsa.pub abc123 |
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 | |
path = require "path" | |
sayHello = (name)-> | |
console.log "Hello,", name, "!" | |
module.exports = | |
say: sayHello | |
if process.argv[1] == __filename |
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 | |
hello = require "./hello" | |
hello.say "Jhon" |
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 "underscore" | |
dig = (path)-> | |
paths = path.split "/" | |
n = paths.length | |
seq = ([0 .. n-1].map (e)-> [0..e]).reverse() | |
_.zip(seq, [0 .. n-1].map (e) -> paths) | |
.map((e)-> e[0].map (i)-> e[1][i]) | |
.map((e)-> e.join "/") |
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
<!DOCTYPE HTML> | |
<body> | |
<div id='f0' data-foo_0='{"age":37,"name":"ichiro"}'>foo_0</div> | |
<div id='f1' data-foo_1='{age:37,name:"ichiro"}'>foo_1</div> | |
<div id='f2' data-foo-2='{"age":37}'>foo-2</div> | |
<div id='f3' data-foo-bar='{"age":37}'>foo-bar</div> | |
<div id='f4' data-fiz-biz="{'age':37}">fiz-biz</div> | |
<div id='ichiro' data-profile='{"eyes":"black","age":37,"alive":true,"likes":["apple","orange"],"phones":{"iphone":"4S","android":"nexus7"}}'>ichiro</div> | |
<div id='jiro' data-profile='{"tall":172}' data-name='jiro'>jiro</div> |
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
INFO global: Vagrant version: 1.2.2 | |
INFO manager: Registered plugin: ssh communicator | |
INFO manager: Registered plugin: reload command | |
INFO manager: Registered plugin: ssh command | |
INFO manager: Registered plugin: up command | |
INFO manager: Registered plugin: provision command | |
INFO manager: Registered plugin: halt command | |
INFO manager: Registered plugin: destroy command | |
INFO manager: Registered plugin: box command | |
INFO manager: Registered plugin: package command |
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
var toValue = function(it) { | |
if (typeof it == "string") | |
return "'" + it + "'"; | |
if (it.constructor === Array) | |
return "Array[" + it.length + "]"; | |
return it; | |
} | |
var showProperties = function(p, obj, indent) { | |
if (typeof obj == "function") { |