Skip to content

Instantly share code, notes, and snippets.

# Build an inverted index for a full-text search engine with Redis.
# Copyright (C) 2009 Salvatore Sanfilippo. Under the BSD License.
# USAGE:
#
# ruby invertedindex.rb add somedir/*.c
# ruby invertedindex.rb add somedir/*.txt
# ruby search your query string
require 'rubygems'
require 'redis'
@lessthanyouthink
lessthanyouthink / CJProperRotationNavigationController.h
Created October 5, 2012 20:27
A simple UINavigationController subclass to handle iOS 6's orientation changes better.
//
// CJProperRotationNavigationController.h
//
// Created by Charles Joseph on 2012-10-01.
//
#import <UIKit/UIKit.h>
@interface CJProperRotationNavigationController : UINavigationController
@copiousfreetime
copiousfreetime / gist:59067
Created February 5, 2009 22:34
Postgres Partitioning with RETURNING on insert
-- A method to have RETURNING work if you are partitioning data using trigger.
-- The method to this madness is:
--
-- 1) Use the normal trigger mechanism to insert the data into the child tables, but
-- Instead of the trigger function returning NULL so that the row does not get⋅
-- inserted into the master table, it returns the row inserted into the child
-- table
--
-- 2) Postgres will insert the new row from the trigger into the master table
--
@matthewmccullough
matthewmccullough / git-deletealltags.bsh
Created April 1, 2011 20:29
Script to delete all tags both locally and remotely
for t in `git tag`
do
git push origin :$t
git tag -d $t
done
//
// NSObject+BlockObservation.h
// Version 1.0
//
// Andy Matuschak
// andy@andymatuschak.org
// Public domain because I love you. Let me know how you use it.
//
#import <Cocoa/Cocoa.h>