Skip to content

Instantly share code, notes, and snippets.

View girasquid's full-sized avatar
🦐

Luke Hutscal girasquid

🦐
View GitHub Profile
<% if @chapter == 'first' %>
<p>Welcome to your adventure page. This is where you'll be able to see what all has happened in the story, in addition to being able to work through it (at your own pace, of course).</p>
<p>The first thing you should do is probably go check out <%= link_to "the Mine", :controller => :mine, :action => :index %>.</p>
<% end %>
/*
* Sweet sugar for jQuery's $.data API.
* http://yehudakatz.com/2009/04/20/evented-programming-with-jquery/
*
* Instead of this:
*
* $("#foo").data("foo"); // Get foo
* $("#foo").data("foo", 'bar'); // Set foo
*
* Do this:
python -m smtpd -n -c DebuggingServer localhost:1025
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
## How to create a user in Authlogic
User.create(:username => 'foo', :password => 'bar', :password_confirmation => 'bar')
# encoding: utf-8
from bottle import route, request, run, redirect, get, post
@get('/')
def home():
return """
<form action='' method='post'>
<input type='hidden' name='things' value='éøéóí' />
Some unicodé!
<input type='submit' />
def converse(body)
link_to body, '#', :class => 'converse'
end
def converse(body)
link_to body, '#', :class => 'converse'
end
@girasquid
girasquid / gist:1063871
Created July 4, 2011 20:14
Nag the admins when someone leaves a pdb.set_trace() in production
from django.conf import settings
from django.core.mail import mail_admins
def pdb_replacement():
import inspect
current_frame = inspect.currentframe()
info = inspect.getframeinfo(current_frame.f_back.f_back)
mail_admins("pdb left in %s" % info[0], "%s, line #%s" % (info[0], info[1]))
return
@girasquid
girasquid / ubuntu_setup.sh
Created September 24, 2011 17:30 — forked from kylefox/ubuntu_setup.sh
Automated setup for a Ubuntu server with git, ruby, rvm, nginx.
#!/usr/bin/env bash
# ----------------------------------------------------
#
# Automated setup for a Ubuntu server with git, ruby, rvm, nginx.
# (Used at Carbonmade)
#
# Usage:
# - SCP this file to your server: scp ubuntu_setup.sh you@server:~
# - Make it executable: chmod +x ubuntu_setup.sh
# - Run it: bash ubuntu_setup.sh