Skip to content

Instantly share code, notes, and snippets.

View georgel's full-sized avatar

George georgel

  • Yellow Lab
  • San Francisco
View GitHub Profile
// use the built-in ios linguistics functionality to stem the tags
+ (NSMutableArray *)stemTags:(NSMutableArray*)originalTags {
NSLinguisticTagger *tagger = [[NSLinguisticTagger alloc]
initWithTagSchemes:[NSArray arrayWithObjects:NSLinguisticTagSchemeLemma, nil]
options:(NSLinguisticTaggerOmitWhitespace | NSLinguisticTaggerOmitPunctuation)];
NSMutableArray *stemmedTags = [[NSMutableArray alloc] init];
// convert tags to string
[tagger setString:[originalTags componentsJoinedByString:@" "]];
### Install OpenJDK
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
### Download and Install ElasticSearch
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch and replace wget link below
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.3.1.deb
sudo dpkg -i elasticsearch-1.3.1.deb

#Search Framework (Product)

DASHBOARDS

  • User segment (e.g. new vs return)
  • Mobile (mobile, iOS, android) vs. Desktop
  • Metro vs. Suburb
  • Service category performance deltas
  • Search types breakdown
    • General service (e.g. haircut)
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@georgel
georgel / passwords_controller.rb
Created October 30, 2012 03:45 — forked from kazpsp/passwords_controller.rb
StrongParameters with Devise
# app/controllers/users/password_controller.rb
class Users::PasswordsController < Devise::PasswordsController
def resource_params
params.require(:user).permit(:email, :password, :password_confirmation)
end
private :resource_params
end
@georgel
georgel / nesting.coffee
Created September 16, 2012 02:18 — forked from lagartoflojo/nesting.coffee
Helper function for nesting Backbone collections (CoffeeScript version)
Backbone.Model::nestCollection = (attributeName, nestedCollection) ->
#setup nested references
for item, i in nestedCollection
@attributes[attributeName][i] = nestedCollection.at(i).attributes
#create empty arrays if none
nestedCollection.bind 'add', (initiative) =>
if !@get(attributeName)
@attributes[attributeName] = []
@get(attributeName).push(initiative.attributes)
@georgel
georgel / mongoid.rb
Created June 15, 2012 04:45 — forked from durran/mongoid.rb
Custom database persistence.
module CustomDatabase
extend ActiveSupport::Concern
included do
store_in database: custom_database
end
module ClassMethods
def custom_database
@georgel
georgel / gist:2550017
Created April 29, 2012 12:14 — forked from botchagalupe/gist:666110
General Chef Notes

Chef Demo One

Prep Work

knife cookbook site vendor -d ntp

Use chef-solo to launch ntp...

Chef Demo Two

@georgel
georgel / gist:2533961
Created April 29, 2012 06:12 — forked from henrygarner/gist:1123179
Resources for setting up RVM and Passenger on Chef
http://www.agileweboperations.com/chef-rvm-ruby-enterprise-edition-as-default-ruby
http://www.christophersamuelson.com/2010/10/22/chef-rvm-capistrano-bundler/
http://blog.ninjahideout.com/posts/a-guide-to-a-nginx-passenger-and-rvm-server
http://brandontilley.com/2011/01/29/serving-rails-apps-with-rvm-nginx-unicorn-and-upstart.html
http://brandontilley.com/2011/01/29/rvm-unicorn-and-upstart.html
Chef workflow
# Install cookbook from opscode community site. (Automatically commits to local repo)
knife cookbook site install <COOKBOOK_NAME>
@georgel
georgel / setup-statsd.sh
Created April 26, 2012 09:28 — forked from rw/setup-statsd.sh
Turn an Ubuntu 11.10 EC2 into a StatsD/Graphite server
# install git
sudo apt-get install g++ curl libssl-dev apache2-utils
sudo apt-get install git-core
sudo apt-get install nodejs
# install the Node package manager for later use
curl http://npmjs.org/install.sh | sudo sh
sudo npm install express
# clone the statsd project
git clone https://github.com/etsy/statsd.git
# download everything for graphite