Skip to content

Instantly share code, notes, and snippets.

View simeonwillbanks's full-sized avatar
☀️
😎

Simeon Willbanks simeonwillbanks

☀️
😎
View GitHub Profile
@qrush
qrush / gist:10401517
Created April 10, 2014 16:51
Replace tabs with 4 spaces, remove leading spaces/tabs for Objective-C .m, .h files
find . -name "*.[mh]" | while read line; do expand -t 4 $line > $line.new; mv $line.new $line; done
find . -name "*.[mh]" | while read line; do git stripspace < $line > $line.new; mv $line.new $line; done
" Open NERDTree when vim starts
autocmd VimEnter * NERDTree
autocmd VimEnter * wincmd p
" Map leader key to comma
let mapleader = ","
" NERDTreeFind key binding
noremap <silent> <Leader>f :NERDTreeFind<CR>
/* iphone... */
@media screen and (max-device-width: 480px) {
}
/* ...iphone */
/* iphone portrait... */
@media screen and (max-device-width: 480px) and (orientation:portrait) {
}
/* ...iphone portrait */
@simeonwillbanks
simeonwillbanks / Gemfile.lock.diff
Last active September 26, 2015 02:38
bundle install only #bundler #diff #ruby #Gemfile
diff --git a/Gemfile.lock b/Gemfile.lock
index d2b6ae1..4514854 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -56,6 +56,7 @@ GEM
chronic_duration (0.9.4)
numerizer (~> 0.1.1)
closure-compiler (1.1.1)
+ columnize (0.3.3)
crack (0.1.8)
@jrust
jrust / application.js
Created July 19, 2011 17:45
Binding events to both onload content and ajax-loaded content.
var Application = {
// @see attach_behaviors();
behaviors: {},
init: function() {
$('body').bind('ajaxSuccess', Application.attach_behaviors);
Lessonplanet.attach_behaviors();
},
/**
@scott-stewart
scott-stewart / gist:1269328
Created October 7, 2011 02:55
SimpleForm Nested Label Component for Twitter Bootstrap CSS
# <rails_root>/lib/simple_form/label_nested_input.rb
module SimpleForm
module Components
module LabelInput
extend ActiveSupport::Concern
included do
include SimpleForm::Components::Labels
end
@thbar
thbar / fixes.md
Created November 6, 2011 14:00
Getting rid of nokogiri segfaults

This readme is a mixture of everything I read on SO+nokogiri wiki, which ultimately worked out for me.

Here are the steps which worked for me to get rid of segfaults with Nokogiri 1.4.4, on both Lion and Snow Leopard, with Ruby 1.8.7 (patchlevel 334 and +).

First diagnose which version of libxml2 you're using:

bundle exec nokogiri -v

If you have 2.7.3 listed somewhere, you're in bad waters (known to segfault). Install this:

@avdi
avdi / match_method.rb
Created December 6, 2011 21:27
Defining method_missing and respond_to? in one fell swoop
# Do you ever define #method_missing and forget #respond_to? I sure
# do. It would be nice if we could do them both at the same time.
module MatchMethodMacros
def match_method(matcher, &method_body)
mod = Module.new do
define_method(:method_missing) do |method_name, *args|
if matcher === method_name.to_s
instance_exec(method_name, *args, &method_body)
else
@seyhunak
seyhunak / simple_form.rb
Created December 14, 2011 23:17
Using simple_form and integrating Twitter Bootstrap
1. Use latest build
gem 'simple_form', :git => 'git://github.com/plataformatec/simple_form.git'
2. Create an initializer
# /config/initializers/simple_form.rb
# Use this setup block to configure all options available in SimpleForm.
SimpleForm.setup do |config|
# Wrappers are used by the form builder to generate a complete input.
# You can remove any component from the wrapper, change the order or even
@justinko
justinko / gist:1684051
Created January 26, 2012 17:59
Methods to aid in testing without loading the Rails environment
def stub_model(model_name)
stub_class model_name, ActiveRecord::Base
end
def stub_class(class_name, super_class = Object)
stub_module class_name, Class.new(super_class)
end
def stub_module(module_name, object = Module.new)
module_name = module_name.to_s.camelize