Skip to content

Instantly share code, notes, and snippets.

@bahelms
bahelms / gist:8cde38a65fbb23106a6d
Last active August 29, 2015 14:02
Print out file system text filtered thru a ruby regex at the command line
# You can use ls, echo, grep; whatever you are looking for.
# I wanted a list of just the rails migration filename timestamps, e.g.
$ ls rails_app/db/migrate/ | xargs -n1 | ruby -e "puts $<.read.scan(/\d*/)"
@bahelms
bahelms / namespace.coffee
Last active August 29, 2015 14:00
How to namespace in CoffeeScript
# Node.js is exports; Rails is window
global = if typeof exports isnt 'undefined' then exports else window
global.namespace = (target, name, block) ->
[target, name, block] = [global, arguments...] if arguments.length < 3
top = target
target = target[item] or= {} for item in name.split '.'
block target, top
# Declare your class