Skip to content

Instantly share code, notes, and snippets.

View brandon-beacher's full-sized avatar
💭
🦑

Brandon Beacher brandon-beacher

💭
🦑
View GitHub Profile

Git Workflow

Branch from master

Branch from master, naming your branch with your initials, the Tracker Story ID, and a description of the story.

Here is an example branch name:

bgb/24096875_add_vcard_column_auto_mapping
@brandon-beacher
brandon-beacher / gist:2662072
Created May 11, 2012 19:56
sublime user preferences
{
"binary_file_patterns":
[
"*.jpg",
"*.jpeg",
"*.png",
"*.gif",
"*.ttf",
"*.tga",
"*.dds",
$("ul#selected_lessons a").live("click", function(event) {
event.preventDefault();
$(this).closest("li").appendTo($("ul#available_lessons"));
$("ul#available_lessons").sortable("refresh");
$("ul#selected_lessons").sortable("refresh");
$.post(
$("ul#selected_lessons").data("update-url"),
$("ul#selected_lessons").sortable("serialize"));
});
it "should sort chapters" do
overview_activity = create(:overview_activity)
first_chapter = create(:chapter,
activity: overview_activity,
position: 1,
title: "First Chapter")
second_chapter = create(:chapter,
activity: overview_activity,
position: 2,
title: "Second Chapter")
#!/bin/bash
TMP_FILE=`mktemp /tmp/XXXXXX`
git diff $1 $2 > "$TMP_FILE.diff"
mate -w -n "$TMP_FILE.diff"
class AgenciesController < ApplicationController
before_filter :require_user
def show
@agency = Agency.find(params[:id])
forbid unless current_user.admin_of_agency?(@agency)
end
end
# drop this in lib/forbidden_error.rb
class ForbiddenError < StandardError
end
class ApplicationController < ActionController::Base
protect_from_forgery
helper_method :current_user
def current_user
@current_user ||= User.find_by_id(session[:user_id])
end
private
ActiveRecord::Schema.define(:version => 20120330150918) do
create_table "users", :force => true do |t|
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "email"
t.string "password_digest"
t.string "invitation_token"
end
class User < ActiveRecord::Base
has_secure_password
validates :email,
presence: true,
uniqueness: true
end