Skip to content

Instantly share code, notes, and snippets.

baroquebobcat / Hash.from_xml_using_Nokogiri.rb
Created Jan 12, 2012 — forked from dimus/Hash.from_xml using Nokogiri
Adding Hash.from_xml method using Nokogiri
View Hash.from_xml_using_Nokogiri.rb
# 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
class Nokogiri::XML::Node
def namespaced_name
class A(object):
def __getattr__(s,i):
raise Exception('wth')
def raises(self):
def yep(self):
export NOTIFY_TIME=10
function timer_start {
if [ "$BASH_COMMAND" != "timer_stop" ]
View compare_branches.bash
function silencing_stderr() {
$* 2>/dev/null
function branch_names() {
git br | awk '{print $1}' | grep -v '*' | xargs
for branch_name in $(branch_names)
View array_blocking_fair.mirah
import java.util.concurrent.ArrayBlockingQueue
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.atomic.AtomicLong
queue_size = 10
queue = queue_size, true
counts = {"A"=>, "B" =>}
producerA = do
while true
baroquebobcat / mirah_0_1_2_notes
Created Jan 6, 2014
Mirah 0.1.2 release process notes
View mirah_0_1_2_notes
mirah 0.1.2 release highlights
- improvements to the new mirrors implementation (try it with -T)
- improvements to the new backend implementation (try it with -N)
- added better casting for methods that return primitives (754cc38f)
- =~, include? macros added to String (Thanks altamic)
- << operator added to StringBuilder
- improved line number recording in new backend
- fixed a few macro expansion related bugs
- Added Apache 2 license to gem metadata
baroquebobcat /
Last active Jan 2, 2016
Mirah Lambda Proposal

Mirah Lambda Proposal

Lambda types

  • Stabby / Lambda
  • Block
  • Nested Methods

Stabby / Lambda

View gist:8227106
$ rake gem
rm -rf build/bootstrap
mkdir -p build/bootstrap
Compiling 10 source files to /Users/nick/hacking/mirah_hacking/mirah/build/bootstrap
baroquebobcat / symbol_curry.rb
Last active Dec 31, 2015
Symbol#curry, because one kind of curry just isn't enough
View symbol_curry.rb
# add a curry method to symbol for evil/awesome symbol to proc powers.
class Symbol
def curry(n=nil)
->(*args) {
->(obj) {obj.send self, *args}
def call(*n)