handling uninitialized constant ActiveRecord::RecordNotFound
I kept getting “uninitialized constant ActiveRecord::RecordNotFound” in a Rack app. The fix was to add this at the beginning of the file:
formatting JSON from the commandline using Python
Say you’re doing a CURL request that returns some JSON. If you want to pretty-print it, here’s an easy way to do so:
find out where a rake task is defined
If you want to find out where a particular task is defined:
zsh script to repeatedly check if something changed
I wanted to be notified when CDN Sumo finished provisioning, so I wrote the script above. It can be ran the following way:
zsh q.sh “heroku config:get CDN_SUMO_URL -a my_app” “my_app.herokuapp.com” “CDN_Sumo finished provisioning”
git read tree to move files around
I wanted to copy a directory with all of it’s files from a branch to the current one. This seems to have done the trick:
The prefix switch specifies where to place it, and the -u represents what I want to copy.
creating a bootable windows usb 7 stick from ubuntu
Simple way to create a bootable windows 7 usb stick:
- insert usb stick
- format it as ntfs using gparted
- in case it’s not set, go to Manage flags, and check boot
- insert usb stick again so your ubuntu can remount it
- wait
- reboot, and select your usb stick as your first boot device
- done!
proxying with EventMachine
[EM-Proxy] (https://github.com/igrigorik/em-proxy) is awesome. Check the repo for examples of what it can do. I’ve also played a bit with it, and I made a very basic proxy that won’t forward requests if the User-Agent is curl. Sample code, basic as it is, can be found [here] (https://github.com/International/rev_proxy) .
zsh complete param
Been struggling to have autocompletion based on the param. This is the function:
and here’s the solution I found ( full code provided ) :