Skip to content

Instantly share code, notes, and snippets.

@baroquebobcat
baroquebobcat / quiz-1.md
Created September 27, 2012 23:44 — forked from ahoward/quiz-1.md
quiz-1.md
So you think you wanna be a web developer...

Fork this, update your copy with answers.

They don't need to be precise - pseudo-code is fine in most cases.

Some questions don't have correct answers.

@baroquebobcat
baroquebobcat / polluted.rb
Created November 8, 2012 17:38 — forked from ahoward/polluted.rb
ruby libs have *got* to stop doing this...
libs = ARGV.size == 0 ? all_gems : ARGV
list =
libs.
forkify(16){|lib| puts "#{ lib }..."; [lib, polluted_by(lib)]}.
sort_by{|pair| pair.last}
list.each do |lib, polluted|
puts "polluted_by('#{ lib }') #=> #{ polluted }"
function silencing_stderr() {
$* 2>/dev/null
}
function branch_names() {
git br | awk '{print $1}' | grep -v '*' | xargs
}
function most_recent_commit() {
git log . | grep "Date: " | cut -c 9- | head -1
$ rake gem
rm -rf build/bootstrap
mkdir -p build/bootstrap
Compiling 10 source files to /Users/nick/hacking/mirah_hacking/mirah/build/bootstrap
/Users/nick/hacking/mirah_hacking/mirah/src/org/mirah/IsolatedResourceLoader.java
/Users/nick/hacking/mirah_hacking/mirah/src/org/mirah/MirahClassLoader.java
/Users/nick/hacking/mirah_hacking/mirah/src/org/mirah/jvm/compiler/Cleaned.java
/Users/nick/hacking/mirah_hacking/mirah/src/org/mirah/jvm/types/Flags.java
/Users/nick/hacking/mirah_hacking/mirah/src/org/mirah/jvm/types/MemberAccess.java
/Users/nick/hacking/mirah_hacking/mirah/src/org/mirah/jvm/types/MemberKind.java
function silencing_stderr() {
$* 2>/dev/null
}
function branch_names() {
git br | awk '{print $1}' | grep -v '*' | xargs
}
for branch_name in $(branch_names)
do
@baroquebobcat
baroquebobcat / Hash.from_xml_using_Nokogiri.rb
Created January 12, 2012 22:56 — forked from dimus/Hash.from_xml using Nokogiri
Adding Hash.from_xml method using Nokogiri
# USAGE: Hash.from_xml:(YOUR_XML_STRING)
#
# - fixes handling of <text> elements
# - prepends namespaces on keys where used including both elements & attributes
# - uses strings instead of symbols to prevent consumption of the symbol table
require 'nokogiri'
# modified from http://stackoverflow.com/questions/1230741/convert-a-nokogiri-document-to-a-ruby-hash/1231297#1231297
class Nokogiri::XML::Node
def namespaced_name