Skip to content

Instantly share code, notes, and snippets.

James Bebbington jamesbebbington

  • London, UK
Block or report user

Report or block jamesbebbington

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View form_errors_for_associations.rb
module ActiveModelInstanceTagWithAssociations
def error_message
Rails.logger.debug "ActiveModelInstanceTagWithAssociations: " + @method_name.inspect
if @method_name.end_with?('_ids')
# Check for a has_(and_belongs_to_)many association (these always use the _ids postfix field).
association = object.class.reflect_on_association(@method_name.chomp('_ids').pluralize.to_sym)
# Check for a belongs_to association with method_name matching the foreign key column
View ViewController.swift
// ViewController.swift
// SwiftPHFComposeBarTest
import UIKit
import PHFComposeBarView
class ViewController: UIViewController, PHFComposeBarViewDelegate {
var composeBar: PHFComposeBarView {
let viewBounds = self.view.bounds
View prosody.cfg.lua
-- Prosody XMPP Server Configuration
-- Information on configuring Prosody can be found on our
-- website at
-- Tip: You can check that the syntax of this file is correct
-- when you have finished by running: prosodyctl check config
-- If there are any errors, it will let you know what and where
-- they are, otherwise it will keep quiet.
View gist:6868277
$ sencha app build -run native
Sencha Cmd v4.0.0.203
[INF] init-plugin:
[INF] cmd-root-plugin.init-properties:
[INF] init-properties:
[INF] init-sencha-command:
View cells_3.6.4_test_failures.out
ree-1.8.7@cells (master) lebigmac:cells james$ gem list
*** LOCAL GEMS ***
abstract (1.0.0)
actionpack (3.0.9)
activemodel (3.0.9)
activesupport (3.0.9)
builder (2.1.2)
bundler (1.0.17)
jamesbebbington / application_cell.rb
Created Aug 12, 2011
ArgumentError with CellTests
View application_cell.rb
class ApplicationCell < Cell::Rails
helper ApplicationHelper
helper I18nHelper
jamesbebbington / application_controller.rb
Created Aug 4, 2011 — forked from robertsosinski/caching_with_request_forgery_protection.rb
Rack middleware and form tag patch to insert csrf tokens into cached pages
View application_controller.rb
class ApplicationController < ActionController::Base
after_filter :inject_csrf_token
def inject_csrf_token
if protect_against_forgery? && token = session['_csrf_token']
if body_with_token = response.body.gsub!(TOKEN_PLACEHOLDER, token)
jamesbebbington / template_handlers.rb
Created Jul 20, 2011
Rails 3 Textile Template Handler with ERB
View template_handlers.rb
# config/initializers/template_handlers.rb
require 'action_view/template/handlers/textile'
ActionView::Template.register_template_handler :textile,
View .bash_profile
# bash history (see:
export HISTCONTROL=erasedups
export HISTSIZE=10000
shopt -s histappend
export PATH=$PATH:/usr/local/mysql/bin/
# For mysql gem install. See:
export ARCHFLAGS="-arch i386"
View named_scopes_condition_merging.rb
class Project < ActiveRecord::Base
named_scope :foo, :conditions => [' IN(?)', [1,2,3]]
named_scope :bar, :conditions => [' IN(?)', [2,3,4]]
$ ./script/console
Loading development environment (Rails 2.3.9)
ree-1.8.7-2010.02 :001 >
Project Load (0.5ms) SELECT * FROM `projects` WHERE (( IN(2,3,4)) AND ( IN(1,2,3))) ORDER BY
You can’t perform that action at this time.