Skip to content

Instantly share code, notes, and snippets.


Phillip Koebbe phillipkoebbe

  • Carlinville, IL
View GitHub Profile
phillipkoebbe / user.rb
Created Aug 20, 2012
Small Rails code sample
View user.rb
class User < ActiveRecord::Base
UNKNOWN_EMAIL = "That email address isn't registered."
WRONG_PASSWORD = 'Password is incorrect.'
attr_accessor :password
attr_accessible :email, :password, :country_id
belongs_to :country
has_many :budgets, :dependent => :destroy
phillipkoebbe / Gemfile
Created Apr 9, 2012
request spec slowdown
View Gemfile
source ''
gem 'rails', '3.2.2'
gem 'haml'
gem 'haml-rails'
gem 'coffee-filter'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
View gist:1904456
Process: Sublime Text 2 [7319]
Path: /Applications/Sublime Text Text 2
Identifier: com.sublimetext.2
Version: Beta, Build 2180 (2180)
Code Type: X86-64 (Native)
Parent Process: launchd [258]
Date/Time: 2012-02-24 17:10:14.617 -0600
OS Version: Mac OS X 10.7.3 (11D50)
Report Version: 9
phillipkoebbe /
Created Dec 25, 2011
Sublime Text 2 Multiple Find/Replace script
# This script allows you to do multiple find/replace operations in one pass. The find/replace
# pairs are defined in a file (defaults to ~/.st2_multiple_find_replace) using the format
# find <separator> replace
# By default, the separator is the hash-pointer (=>), but it can be changed if
# necessary (see below). To use multiple find and replace, save this code to a file in
# your Packages/User folder using whatever name you like. I use
# Edit your user key bindings and pick whatever key combinations you want to trigger
# these operations. On Mac OS X, I chose COMMAND+OPTION+M E to edit and COMMAND+OPTION+M R
phillipkoebbe /
Created Dec 19, 2011 — forked from JeanMertz/
Syntax highlight switcher for Sublime Text 2
import sublime, sublime_plugin
import os, string, re
class DetectFileTypeCommand(sublime_plugin.EventListener):
""" Attempts to choose the correct syntax when more than one could apply. """
def __init__(self):
super(DetectFileTypeCommand, self).__init__()
self.path = None
phillipkoebbe / gist:1457544
Created Dec 11, 2011
Installing ruby-debug19 on ruby 1.9.3-p0 on Mac OS X Lion 10.7.2 with Xcode 4.2.1
View gist:1457544
# assumes 1.9.3-p0 is already installed in RVM (1.9.2) and you are in an empty gemset
curl -OL
curl -OL
gem install rake
gem install archive-tar-minitar
gem install ruby_core_source
gem install columnize
gem install linecache19-0.5.13.gem -- --with-ruby-include="$rvm_path/src/`rvm tools strings`"
gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include="$rvm_path/src/`rvm tools strings`"
View gist:1444655
// Note that the track_changes function indicated in the callback is part of
// a custom change tracking solution that is called in the onchange event
// of extended form elements.
var date_picker_field_id = 'some-dom-id';
var date_picker_field = $(date_picker_field_id);
form_elements = {};
form_elements[date_picker_field_id] = '%Y-%m-%d';
phillipkoebbe / gist:1163691
Created Aug 22, 2011
akephalos-mootools gem list
View gist:1163691
actionmailer (2.3.11)
actionpack (2.3.11)
activerecord (2.3.11)
activeresource (2.3.11)
activesupport (2.3.11)
akephalos (0.2.5)
archive-tar-minitar (0.5.2)
builder (3.0.0)
capybara (
celerity (0.8.9)
View gist:1006206
Feature: API Messages Create
Scenario: API key is not provided
Given a valid message
When I post the message without the api key
Then the response code should be 401
View gist:784363
class BaseController < ApplicationController
# put everything in here that is common to all controllers
class User::BaseController < BaseController
before_filter :require_logged_in
def require_logged_in