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
# an abstract beer recipe | |
class BeerRecipe | |
attr_accessor :name, :original_gravity, :terminal_gravity, :color, :alcohol | |
end | |
# create an empty list to store your recipes | |
recipes = [] | |
# create a concrete beer recipe | |
pilsner = BeerRecipe.new |
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://www.weekendbrewer.com/brewingformulas.htm#Color | |
def ebc_to_srm units | |
units * 0.375 + 0.46 | |
end | |
def srm_to_ebc units | |
(units - 0.46) / 0.375 | |
end |
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
/* | |
Inspired by http://github.com/iande/code_bucket/raw/d6a29da107e7347612aa24803e4ee32cd4395220/birds/combinators.rb | |
*/ | |
var birds = { | |
"blue": function(x, y, z) { return x(y(z)); }, | |
"cardinal": function(x, y, z) { return x(y)(z); }, | |
"dove": function(x, y, z, w) { return x(y)(z(w)); }, | |
"eagle": function(x, y, z, w, v) { return x(y)(z(w)(v)); }, | |
"finch": function(x, y, z) { return z(y)(x); }, |
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 HTTPUtil; | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.InputStreamReader; | |
import java.io.OutputStream; | |
import java.io.OutputStreamWriter; | |
import java.io.Reader; | |
import java.io.Writer; |
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 com.teamsketchy.utils; | |
import java.util.LinkedList; | |
import java.util.ListIterator; | |
public class FudiParser { | |
public static LinkedList<String[]> tokenize(String string) { | |
LinkedList<String[]> tokens = new LinkedList<String[]>(); | |
for(int i = 0; i < string.length(); i++) { |
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 client = dgram.createSocket("udp4"); | |
client.on("message", function(data, info) { | |
console.log("got: " + data.toString("utf8") + " from " + info.address); | |
}); | |
client.on("listening", function() { | |
console.log("client listening " + client.address().address); | |
setTimeout(function() { | |
var message = new Buffer("A message at " + (new Date())); |
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 sys = require("sys"); | |
var events = require('events') | |
var childProcess = require('child_process'); | |
var Uuid = function() { | |
var self = this; | |
this.generate = function() { | |
var child = childProcess.exec( | |
'uuidgen | tr [:upper:] [:lower:]', |
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
<?xml version="1.0"?> | |
<!DOCTYPE cross-domain-policy SYSTEM | |
"http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd"> | |
<cross-domain-policy> | |
<allow-access-from domain="*" to-ports="*"/> | |
</cross-domain-policy> |
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 Emitter = function() { | |
var self = this; | |
var ls = {}; | |
this.emit = function(event) { | |
var i, args = []; | |
for(i = 1; i < arguments.length; i++) { | |
var argument = arguments[i]; | |
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
// parse the FUDI networking protocol used by PureData and Max/MSP | |
// http://wiki.puredata.info/en/FUDI | |
// usable in any CommonJS environment including in-browser or in node.js | |
// still requires TCP/UDP JS client/server implementations | |
var fudi = { | |
tokenize: function(string) { | |
var tokens = []; | |
for(var i = 0; i < string.length; i++) { |