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
(ns example.stdin) | |
(defn do-something-cool [v] | |
(println v)) | |
(defn -main | |
"Read from STDIN" | |
[& args] | |
(println "Enter text:") |
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
;; override the default keybindings in paredit | |
(eval-after-load 'paredit | |
'(progn | |
(define-key paredit-mode-map (kbd "<M-right>") 'paredit-forward-slurp-sexp) | |
(define-key paredit-mode-map (kbd "<M-left>") 'paredit-forward-barf-sexp) | |
(define-key paredit-mode-map (kbd "<C-right>") nil) | |
(define-key paredit-mode-map (kbd "<C-left>") nil))) |
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
package quux00.curator; | |
import java.util.Collection; | |
import java.util.Iterator; | |
import java.util.UUID; | |
import java.util.concurrent.TimeUnit; | |
import org.apache.curator.RetryPolicy; | |
import org.apache.curator.framework.CuratorFramework; | |
import org.apache.curator.framework.CuratorFrameworkFactory; |
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
package main; | |
import ( | |
"fmt" | |
"math/rand" | |
"time" | |
) | |
var ( | |
Web1 = fakeSearch("web1") |
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
// implements Knuth or Fisher-Yates shuffle | |
package knuth | |
import ( | |
"math/rand" | |
"time" | |
) | |
func init() { | |
rand.Seed(time.Now().UTC().UnixNano()) |
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
(ns example.stdin) | |
(defn -main | |
"Read from STDIN" | |
[& args] | |
(println "Enter text:") | |
(loop [input (read-line)] | |
(when-not (= ":done" input) | |
(println (str "You entered: >>" input "<<")) |
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
package main | |
// A concurrent prime sieve | |
// from: http://play.golang.org/p/9U22NfrXeq | |
// Send the sequence 2, 3, 4, ... to channel 'ch'. | |
func Generate(ch chan<- int) { | |
for i := 2; ; i++ { | |
ch <- i // Send 'i' to channel 'ch'. | |
} |
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
fn double(a: int) -> int { a * 2 } | |
fn ntimes(f: proc(int) -> int, times: int) -> proc(int) -> int { | |
proc(x: int) { | |
match times { | |
0 => { x }, | |
_ => { f(ntimes(f, times - 1)(x)) } // swap the order relative to the original example | |
} | |
} | |
} |
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
use std::io::File; | |
use std::str; | |
fn main() { | |
let file_name_abs = ~"foo"; | |
let mut response =~ ""; | |
match File::open(&Path::new(file_name_abs)) { | |
Some(html_file) => { | |
let mut html_file_mut = html_file; |
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
package main | |
import ( | |
"fmt" | |
"runtime" | |
) | |
func whisper(left, right chan int) { | |
left <- 1 + <- right | |
} |
NewerOlder