Skip to content

Instantly share code, notes, and snippets.

#
# Usage: %> rails <projectname> -m http://gist.github.com/130543.txt
#
# Install gems
gem 'will_paginate', :source => "http://gemcutter.org/"
gem "factory_girl", :source => "http://gemcutter.org/"
gem "formtastic", :source => "http://gemcutter.org/"
gem "authlogic", :source => "http://gemcutter.org/"
gem "rspec", :source => "http://gemcutter.org/"
searchable do
text :name
string :name
string :phone
integer :review_count do
reviews.size
end
integer :stars
end
From da3be5e481fb902b15cf5d349391bae3c75f2b7e Mon Sep 17 00:00:00 2001
From: Ben Yee <[email protected]>
Date: Wed, 19 Aug 2009 10:25:42 -0700
Subject: [PATCH] add localsolr libs and bump version
---
VERSION.yml | 4 +-
sunspot.gemspec | 115 +++++++++++++++++++++++++++++++++++++++++-----------
tasks/gemspec.rake | 2 +-
3 files changed, 94 insertions(+), 27 deletions(-)
integer :category_ids, :multiple => true do
cached_displayable_categories.map{ |category| category.id } unless cached_displayable_categories.empty?
end
def nationwide_search
category_ids = self.category_ids
Business.search do |search|
search.any_of do
with :category_ids, category_ids unless category_ids.blank?
with :category_ids, nil
end
search.keywords query
search.order_by :name if order == :alpha
search.order_by :review_count, :desc if order == :review_count
search = Sunspot.new_search(Business)
search.build do |s|
s.keywords "#{query} electronics"
s.order_by :name if order == :alpha
s.order_by :review_count, :desc if order == :review_count
s.order_by :stars, :desc if order == :rating
s.paginate :page => page, :per_page => per_page
end
search.query.add_component(OpenStruct.new(:to_params => { :mm => 1 }))
search.execute!
// change city
$(document).ready(function() {
// hides the slickbox as soon as the DOM is ready
// (a little sooner than page load)
var $altCity = $('#altCity');
var $altCity2 = $('#altCity2');
var $altCityHide = $('#altCityHide');
var $altCityShow = $('#altCityShow');
@bsy
bsy / gist:3160923
Created July 22, 2012 20:12
tmux cheat sheet
tmux -- terminal multiplexer
Managing tmux sessions:
$ tmux # start tmux server
$ tmux at # attach running sessions to a terminal
$ tmux ls # list running tmux sessions
Sharing sessions between terminals:
$ tmux new -s session_name # make new named session
$ tmux at -t session_name # attach to exist session (allowing shared sessions)
@bsy
bsy / gist:4506256
Last active December 10, 2015 22:59
We have an open position at Kabam for a mid-level Backend Engineer. You would be working on my game team - The Hobbit: Armies of the Third Age!
Some reasons to consider in addition to the stock and competitive salary reasons:
* Work on a modern technology stack (Node.js, Rails 3.2+, MySQL, Redis)
* We're agile and practice TDD in order to move fast and NOT break things :), continuous integration, and solid build processes
* Interesting technical problems to solve involving low-level socket programming, server infrastructure scaling, AI programming, and software design, among other things
* Work on a game that has the IP from one of the largest fantasy franchises in history, The Hobbit!! And we've still got two more movies to go!
* Awesome team of talented, easy-to-work-with peers, very supportive management
* Healthy, profitable company who is a leader in Free to Play gaming across multiple platforms with plans for an IPO in the future
@bsy
bsy / gist:4732506
Last active December 12, 2015 06:49
Throttle specific ports on Mac OSX
# on
sudo ipfw pipe 1 config bw 150KByte/s
sudo ipfw add 1 pipe 1 src-port 80
# off
sudo ipfw delete 1