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
| //http://go-tour-jp.appspot.com/#35 | |
| package main | |
| import "code.google.com/p/go-tour/pic" | |
| func f0(x, y int) uint8 {return uint8(x^y)} | |
| func f1(x, y int) uint8 {return uint8((x+y)/2)} | |
| func f2(x, y int) uint8 {return uint8(x*y)} | |
| func Pic(dx, dy int) [][]uint8 { |
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
| var App = require("./app"); | |
| new App().start("cli.js"); |
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 App() {} | |
| App.prototype.start = function(msg) { | |
| console.log("started:", msg); | |
| } | |
| module.exports = App; | |
| if (!module.parent) { | |
| new App().start("app.js"); |
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
| 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") { |
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
| 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 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
| <!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 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
| _ = 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 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 coffee | |
| hello = require "./hello" | |
| hello.say "Jhon" |
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 coffee | |
| path = require "path" | |
| sayHello = (name)-> | |
| console.log "Hello,", name, "!" | |
| module.exports = | |
| say: sayHello | |
| if process.argv[1] == __filename |
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 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 |