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
$.get("http://localhost:4567/?document=" + encodeURIComponent(JSON.stringify(document)), function(data, status) {}); |
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
#include <iostream> | |
#include <functional> | |
using namespace std; | |
template <typename K, typename V, int TABLE_SIZE = 100> | |
class HashMap | |
{ | |
private: | |
struct HashNode |
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
class String | |
def colorize(color_code) | |
"\e[#{color_code}m#{self}\e[0m" | |
end | |
color_escapes = {"black" => 30, "red" => 31, "green" => 32, "yellow" => 33, "blue" => 34, "magenta" => 35, "cyan" => 36, "white" => 37} | |
color_escapes.each do |key, value| | |
define_method(key) { colorize(value) } |
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
module Attrs | |
def attr_initialize(*vars) | |
define_method(:initialize) do |*values| | |
unless values.length == vars.length | |
raise ArgumentError, "wrong number of arguments (#{values.length} for #{vars.length})" | |
end | |
vars.zip(values).each do |var, value| | |
instance_variable_set("@#{var}", value) |
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
#include <stdlib.h> | |
void* operator new(size_t size) | |
{ | |
return malloc(size); | |
} | |
void operator delete(void *ptr) | |
{ | |
if (ptr) |
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
#define NSLog(FORMAT, ...) fprintf( stderr, "%s\n", [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String] ); |
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
framework "Cocoa" | |
task = NSTask.new | |
task.launchPath = "/bin/ls" | |
task.arguments = ["-l", "-a"] | |
stdoutPipe = NSPipe.pipe | |
task.standardOutput = stdoutPipe | |
task.launch |
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
#!/bin/sh | |
# From http://svn.gna.org/viewcvs/*checkout*/etoile/trunk/Etoile/LiveCD/Subscripts/ubuntu-install-etoile.sh?content-type=text%2Fplain | |
# Date: Aug 7, 2012 | |
# Initialize option variables with default values | |
BUILD_DIR=$PWD/build | |
PREFIX_DIR=/ | |
ETOILE_VERSION=trunk |
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
class Fibonacci: | |
def __init__(self): | |
self.x, self.y = 0, 1 | |
def printSeq(self, count): | |
for i in range(count): | |
print self.x | |
self.x, self.y = self.y, self.x + self.y |