Skip to content

Instantly share code, notes, and snippets.

View benaldred's full-sized avatar

Ben Aldred benaldred

View GitHub Profile

Resources:

https://github.com/ankane/searchkick

Indexing

By default, simply adding the call 'searchkick' to a model will do an unclever indexing of all fields (but not has_many or belongs_to attributes).

In practice, you'll need to customize what gets indexed. This is done by defining a method on your model called search_data

def search_data

@benaldred
benaldred / Boxedup Gemfile
Created November 17, 2011 10:59
Recent Gem files
source "http://rubygems.org"
gem "rails", "~> 2.3.5", :require => nil
gem 'will_paginate', '2.3.11'
gem 'warden', '0.10.4'
gem 'devise', '1.0.7', :path => "vendor/gems/devise-1.0.7"
gem 'rpx_now', :git => 'git://github.com/boxedup/rpx_now.git'
gem 'devise_rpx_connectable', '0.1.2', :path => "vendor/gems/devise_rpx_connectable-0.1.2"
gem 'formtastic', '0.9.7'
@benaldred
benaldred / gist:663014
Created November 4, 2010 19:21
Instagram Badge
<!-- Start of Instagram Badge -->
<style type="text/css">
/*
crafted by benaldred - http://geekmade.co.uk
heavily influenced by flickr badge
See http://geekmade.co.uk/post/1481180121/instagram-javascript-badge for information on how to use it.
Instagram logo is from twitter
context "blah" do
setup do
@flash = "flash message"
end
#why is @flash nil?
should_set_the_flash_to @flash
end
@benaldred
benaldred / init.d nginx script
Created October 3, 2009 14:01
An init.d for nginx based on the default passenger install
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
require 'cucumber/formatter/html'
class NiceHtml < Cucumber::Formatter::Html
def initialize(step_mother, io, options)
super(step_mother, io, options)
end
def inline_css
@builder.style(:type => 'text/css') do
@benaldred
benaldred / spec_notes.rake
Created October 8, 2008 11:48
rake notes for rails 1.2.6 and Rspec
# stolen from Rails 2.1
#
# Implements the logic behind the rake tasks for annotations like
#
# rake notes
# rake notes:optimize
#
# and friends. See <tt>rake -T notes</tt> and <tt>railties/lib/tasks/annotations.rake</tt>.
#
# Annotation objects are triplets <tt>:line</tt>, <tt>:tag</tt>, <tt>:text</tt> that