Skip to content

Instantly share code, notes, and snippets.

class Category < ActiveRecord::Base
has_many :posts, :dependent => :destroy
has_many :tags, :through => :posts, :uniq => true
has_one :navigation_item, :as => :navigatable
before_create :set_navigation_item
private
@ramontayag
ramontayag / gist:1315516
Created October 26, 2011 05:17 — forked from shaneog/gist:1198248
elasticsearch ubuntu 11.10
cd ~/Downloads
# Install the required JDK
sudo apt-get install openjdk-6-jre-headless
# Download, extract and move ElasticSearch
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.17.9.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
sudo mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
def punch_asshole
shots_away = Shot.where("cup != 0 and round_id = ? and team_id = ?", round.id, game.away.id)
shots_home = Shot.where("cup != 0 and round_id = ? and team_id = ?", round.id, game.home.id)
if shots_away.count == 2
Player.includes(:shots).where("shots.cup == 0 and shots.round_id = ? and shots.team_id = ?", round.id, game.away.id).assholes += 1
end
if shots_home.count == 2
Player.includes(:shots).where("shots.cup == 0 and shots.round_id = ? and shots.team_id = ?", round.id, game.home.id).assholes += 1
end
(function($) {
$.fn.clippy = function(text, bgcolor) {
console.log("in clippy. I hope to copy this " + text + " after... ");
console.log($(this));
var swf = "/jquery-plugins/clippy-0.0.1/clippy.swf"
if (!bgcolor) {
var node = $(this);
while (node.css('background-color') == 'transparent' && node.length) {
node = node.parent();
}