Skip to content

Instantly share code, notes, and snippets.

@defnull
defnull / gist:1224387
Created September 17, 2011 21:22
Deploy a Bottle app on Heroku
mkdir heroku
cd heroku/
virtualenv --no-site-packages env
source env/bin/activate
pip install bottle gevent
pip freeze > requirements.txt
cat >app.py <<EOF
import bottle
import os
:+1:
:-1:
:airplane:
:art:
:bear:
:beer:
:bike:
:bomb:
:book:
:bulb:
@bulljit
bulljit / transmissionUnRAR.sh
Created January 23, 2011 02:31
Transmission-Daemon Script: OnComplete unrar files and delete torrent
#!/bin/sh
DEST_DIR="/some/other/dir"
function linker() { # create simlink to downloaded files, rather than copy to final directory
if [ ! -d "$DEST_DIR/$1" ]; then mkdir "$DEST_DIR/$1"; fi
cd "$1"
for F in *; do
if [ -d "$F" ]; then linker "$1/$F"; fi
ln -s "$TR_TORRENT_DIR/$1/$F" "$DEST_DIR/$1"
@shinzui
shinzui / Fast user switching with Devise
Created August 30, 2010 02:50 — forked from barinek/Fast user switching with Devise
Fast user switching with devise
Ever wondered how to login as another user within Devise?
Recently we had a feature request that would provide Admins with the ability
to sign is as another user. You could imagine live demonstrations or even production
support calls where you would like to be signed in as another user, yet not
have to ask for or decrypt their current password. After stewing for a bit, we found a
pretty nice solution with Devise.
Here's the Cucumber feature...
# Using bundler 1.0.0.beta.2 now.
source :gemcutter
gem "rack", "1.1.0"
gem "rails", "2.3.8"
# ...
gem "redis", "2.0.3"
gem "redis-store", "1.0.0.beta2"
# ...
@rodreegez
rodreegez / images.rb
Created October 20, 2009 11:12
I was having trouble testing images uploads with the Cucumber && Webrat && Selenium setup. This was basically because I was not calling the file path correctly. To prevent this in future, I wrote a helper to extend the Cucumber World object and explicitly
module ImageHelpers
def image_path(size)
case size
when "thumbnail"
File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "fixtures", "adam_mint.jpg"))
# NOTE: I created a sub dir of "support" called "fixtures" in which to place test files.
else
raise "don't know where to find a #{size} image"
end
end