Skip to content

Instantly share code, notes, and snippets.

View rmw's full-sized avatar

Rebecca Miller-Webster rmw

View GitHub Profile
@rmw
rmw / includes_active_support_concern.rb
Created August 13, 2012 23:05
Adding rails class methods to plugin with ActiveSupport::Concern
module MyModule
extend ActiveSupport::Concern
included do
#class method defined in ActiveSupport::Validations::ClassMethods (i.e. using ActiveSupport::Concern
validate :my_validation
#Rails method defined in ActiveSupport::CoreExt ...
cattr_accessor :yo
@rmw
rmw / jasmine.yml
Created December 7, 2012 21:39
Generate fixtures in Rspec for Jasmine
rake spec:jasmine
rake spec:jasmine:ci
@rmw
rmw / Gemfile
Created December 7, 2012 21:58
Handling vendored javascript in Jasmine + Jasmine headless
gem 'jasmine-headless-webkit', git: "git://github.com/johnbintz/jasmine-headless-webkit.git"
@rmw
rmw / gist:4393257
Created December 27, 2012 23:45
Customize devise views
rails g devise:views
@rmw
rmw / install_ctags.sh
Created January 14, 2013 18:15
Vim + CTags
$ brew install ctags
...modify your $PATH so /usr/local/bin is before /usr/bin
$ which ctags
(should be /usr/local/bin/ctags)
$ haw
$ ctags -R .
Open file, put cursor over Class and do Ctrl + ], you will be brought to the definition.
@rmw
rmw / add_middleware.rb
Last active December 11, 2015 03:48
Railscast ActionController walkthrough * Get class and module inheritance in rails * Add middleware to controller http://railscasts.com/episodes/395-action-controller-walkthrough
class ArticlesController < ApplicationController
use Rack::ShowExceptions, only: :show
# ...
end
@rmw
rmw / application_controller_mobile_only.rb
Last active December 14, 2015 11:59
Using mobile_fu
class ApplicationController < ActionController::Base
protect_from_forgery
has_mobile_fu false
protected
def mobile_only_mobile_fu
set_mobile_format if is_mobile_device?
end
end
@rmw
rmw / .vimrc.local
Created August 1, 2013 21:50
local overrides on haw comp
color desert
set guifont=Monaco:h18.00
set vb
au BufNewFile,BufRead *.ejs set filetype=html
" Maintaining the visual line selection after indenting with '>' or '<'
vmap > >gv
vmap < <gv
" search things
@rmw
rmw / .gvimrc.after
Last active December 20, 2015 12:59
local overrides on haw comp
color solarized
set guifont=Monaco:h18.00
set cc=80
set wildmode=list:longest
set vb
set guioptions=egmrt
set clipboard=unnamed
au BufNewFile,BufRead *.ejs set filetype=html
if filereadable(expand("~/.gvimrc.local"))
@rmw
rmw / application_helper.rb
Last active December 20, 2015 15:39
Print CSS - creating non-semantic print classes Useful for links which auto get expanded into 'text (url)' which you may not want ... especially for email or if the link text is the actual url.
def print_link(text, url)
link_to(text, url, class: 'no-print') <<
content_tag('span', class: 'print-only') { text }
end