Skip to content

Instantly share code, notes, and snippets.

@Florian95
Florian95 / simple_search.rb
Created April 24, 2012 11:34 — forked from jimworm/simple_search.rb
Simple search for all Rails 3.2 ActiveRecord models on any string column(s)
class ActiveRecord::Base
class << self
def has_simple_search(*attrs)
raise 'has_simple_search expects at least one attribute' if attrs.empty?
instance_eval do # because this is ActiveRecord::Base, the class inherits this
class_attribute :simple_search_fields
self.simple_search_fields = attrs.flatten
def simple_search(search_string)
return find(:all) if search_string.nil? || search_string.blank?
attrs = self.simple_search_fields
@nvk
nvk / readme
Created April 19, 2012 18:20
Using Git with Dropbox
### Instructions source http://tumblr.intranation.com/post/766290743/using-dropbox-git-repository ####
-- make empty repo on dropbox:
cd ~/Dropbox/RipeApps/Git
mkdir -p newname.git
cd !$
git --bare init
-- push your junk into it
cd ~/Projects/myrepo
@mgraupner
mgraupner / gist:1859298
Last active September 30, 2015 20:47
MacOS X 10.7.3 and XCode 4.3: Installing Ruby, Gem and Rails
Made an update covering Macos 10.8 and ruby 2.0: https://gist.github.com/michaelsd/5224456
- Install "Command Line Tools for XCode" (Get it from Apple Developer Program) or Install XCode via Appstore
where option one is the faster one, 170MB vs 1.xGB
- Install https://github.com/sstephenson/rbenv
git clone into your home folder;
set environment variables, see install docs of rbenv;
- Get libyaml