Skip to content

Instantly share code, notes, and snippets.

@bchhun
bchhun / form_field.html
Created October 16, 2013 01:22
Twitter Bootstrapped Django Form
<div class="control-group two-columns {% if field.errors %}warning{% endif %}">
<label
class="control-label {% if field.field.required %}bold{% endif %}"
for="{{ field.auto_id }}">
{{ field.label|safe }}
{{ field.required }}
</label>
<div class="controls">
{{ field }}
@aras-p
aras-p / preprocessor_fun.h
Last active July 16, 2024 02:50
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@jwo
jwo / registrations_controller.rb
Created September 30, 2011 23:11
API JSON authentication with Devise
class Api::RegistrationsController < Api::BaseController
respond_to :json
def create
user = User.new(params[:user])
if user.save
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201
return
else