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
package main | |
import ( | |
"go-tour.googlecode.com/hg/wc" | |
"strings" | |
) | |
func WordCount(s string) map[string]int { | |
fields := strings.Fields(s) | |
counts := make(map[string]int) |
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
package main | |
import ( | |
"regexp" | |
"http" | |
"io/ioutil" | |
"os" | |
"template" | |
) |
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
# Given a list of numbers, write in increasing order all the integers you can | |
# obtain using each number once and any combination of addition, | |
# multiplication, division, and subtraction. | |
from itertools import permutations, product | |
from operator import add, mul, div, sub | |
solutions = set() | |
funcs = [add, mul, div, sub] | |
seeds = [22,71,13,1] | |
def polish(tokens): |
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
package main | |
import ( | |
"fmt" | |
"time" | |
"runtime" | |
) | |
func tick() { | |
for { |
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
<h1 id="injection" style="opacity: 0.0; text-align: center; width: 120%;">INJECTION</h1> | |
<script>(function(){ | |
var $injection = $("#injection"); | |
var $parent = $injection.parent().parent(); | |
$parent.children(".message-username").css({opacity: 0.0}); | |
var baseDuration = 2000.0; | |
$injection.animate({"letter-spacing": 50.0, opacity: 1.0}, baseDuration, "linear"); | |
$injection.animate({"letter-spacing": 100.0, opacity: 0.0}, baseDuration, "linear", function() { | |
$parent.remove(); | |
}); |
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
<script src="static/js/raphael-min.js"></script> | |
<span id="injection" style="display:none;"> </span> | |
<script>(function() { | |
var $injection = $("#injection"); | |
var $messageBody = $injection.parent(); // selects the <span> element that the message is written into. | |
var $username = $messageBody.siblings(".message-username"); | |
$username.html(" "); | |
$injection.remove(); | |
var containerId = 'a' + Math.random().toString(36).substring(2); |
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
<script src="static/js/raphael-min.js"></script> | |
<span id="injection" style="display:none;"> </span> | |
<script>(function() { | |
$("#injection").parent().parent().remove(); | |
var paper = new Raphael("content", "100%", "100%"); | |
$(paper.canvas).css({ | |
position: "absolute", | |
left: 0, | |
top: 0, |
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
<html> | |
<head> | |
<title>websockets</title> | |
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script> | |
<script>$(function() { | |
var conn; | |
conn = new WebSocket("ws://localhost:8000/echo"); | |
conn.onopen = function(event) { | |
console.log("WebSocket Connected", event); | |
}; |
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
[30.868, 41.204, 55, 73.416, 97.99, 130.813] @=> float pitches[]; | |
SinOsc o => dac; | |
0.02 => o.gain; // you... will probably want to adjust this depending on your setup. | |
Hid hi; | |
HidMsg msg; | |
1 => int octave; | |
0 => int device; | |
2 => int currentFreq; | |
pitches[currentFreq] => o.freq; |
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 python | |
import requests | |
import argparse | |
parser = argparse.ArgumentParser() | |
parser.add_argument('-d', '--data', type=argparse.FileType('r')) | |
parser.add_argument('-X', '--method', default='GET', nargs='?') | |
parser.add_argument('url') | |
args = parser.parse_args() |