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
# At first glance, this doesn't seem so useful. | |
def a | |
def b | |
'you called b' | |
end | |
'b is now defined' | |
end | |
# > b | |
# NameError: undefined local variable or method `b'... |
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
// Needs to be run from a separate host that | |
// does not consider itself the server it's proxying to. | |
// So ghost the host to a VM running this (as root, for port 80). | |
var sys = require('sys'), | |
http = require('http'), | |
url = require('url'); | |
var port = 80; |
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
# NVM | |
if [[ -s $HOME/.nvm ]] ; then | |
setopt nullglob | |
NVM_DIR=$HOME/.nvm | |
source $NVM_DIR/nvm.sh | |
nvm use | |
fi |
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
common: &common | |
adapter: mysql | |
encoding: utf8 | |
username: root | |
password: | |
development: | |
<<: *common | |
database: app_name |
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
CFLAGS = -O2 -Wall $(OPTFLAGS) | |
CC = clang | |
SOURCES = $(wildcard *.c) | |
OBJECTS := $(patsubst %.c, %.o, $(SOURCES)) | |
all : main | |
main : $(OBJECTS) | |
$(CC) -o main $(CFLAGS) $(OBJECTS) |
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
def unwrap_hash(hash, scope = []) | |
hash.each do |key, value| | |
scope.push key | |
if value.is_a? Hash | |
unwrap_hash value, scope | |
else | |
puts "#{scope.join(':')} = #{value.inspect}" | |
end | |
scope.pop | |
end |
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
# Uses 1.9.2 | |
# Makes use of existing day names in Date class | |
# Demeter is happy | |
# Support full and abbreviated names | |
# Doesn't use seconds (avoids error scenarios when crossing DST & leap-seconds) | |
class DDate < Date | |
def self.next(target_dayname) | |
target_wday = ABBR_DAYNAMES.index { |dayname| target_dayname =~ Regexp.new(dayname) } | |
diff = target_wday - today.wday |
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
class Library | |
def self.leaf_paths_of(paths) | |
PathTree.new(paths).reduce | |
end | |
end | |
class PathTree < Hash | |
def initialize(paths = []) | |
paths.each { |path| self << path } | |
end |
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
Pyrit 0.4.0 (C) 2008-2011 Lukas Lueg http://pyrit.googlecode.com | |
This code is distributed under the GNU General Public License v3+ | |
Running benchmark (22176.6 PMKs/s)... \ | |
Computed 22176.60 PMKs/s total. | |
#1: 'OpenCL-Device 'Juniper'': 23084.8 PMKs/s (RTT 2.8) | |
#2: 'CPU-Core (SSE2)': 628.6 PMKs/s (RTT 3.0) |
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
Pyrit 0.4.0 (C) 2008-2011 Lukas Lueg http://pyrit.googlecode.com | |
This code is distributed under the GNU General Public License v3+ | |
Running benchmark (2747.2 PMKs/s)... \ | |
Computed 2747.16 PMKs/s total. | |
#1: 'OpenCL-Device 'GeForce GT 330M'': 1630.3 PMKs/s (RTT 2.6) | |
#2: 'CPU-Core (SSE2)': 458.1 PMKs/s (RTT 3.1) | |
#3: 'CPU-Core (SSE2)': 477.6 PMKs/s (RTT 3.1) | |
#4: 'CPU-Core (SSE2)': 471.0 PMKs/s (RTT 3.1) |
OlderNewer