Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

# Basic text search with relevancy for MongoDB.
# See http://blog.tty.nl/2010/02/08/simple-ranked-text-search-for-mongodb/
# Copythingie 2010 - Ward Bekker - ward@tty.nl
#create (or empty) a docs collection
doc_col = MongoMapper.connection.db('example_db').collection('docs')
doc_col.remove({})
#add some sample data
doc_col.insert({ "txt" => "it is what it is"})
@spolu
spolu / lock.js
Created August 14, 2011 18:02
Lock for NodeJS
var util = require('util');
var events = require('events');
/**
* A Lock
*
* @extends events.EventEmitter
*
* @param spec {}
*/
@briandoll
briandoll / top_gems.state_of_the_stack.txt
Created September 28, 2011 18:58
Top 50 Ruby Gems in Production : New Relic State of the Stack : Q3 2011
Count Gem
7570 rack
7444 rake
7425 rails
7424 activesupport
7421 bundler
7412 actionpack
7410 actionmailer
7409 activerecord
7397 activeresource
@briandoll
briandoll / top_plugins.state_of_the_stack.txt
Created September 28, 2011 19:00
Top 50 Rails Plugins in Production : New Relic State of the Stack : Q3 2011
Count Plugin
2040 rpm
1534 newrelic_rpm
1268 acts_as_list
1186 paperclip
1130 will_paginate
1068 exception_notification
1026 jrails
1010 restful_authentication
1009 haml
@xdite
xdite / gist:1273518
Created October 9, 2011 10:07
Octopress Wordpress converter
require 'fileutils'
require 'date'
require 'yaml'
require 'rexml/document'
require 'ya2yaml'
include REXML
doc = Document.new(File.new(ARGV[0]))
anonymous
anonymous / 天涯 4000W 数据.txt
Created December 25, 2011 10:58
天涯 4000W 数据
thunder://QUFodHRwOi8veGxpc3N1ZTExMC5zYW5kYWkubmV0L+Wkqea2r+aVsOaNri5rej9maWQ9RldLYVBiYUl0WjZLVUtyTTNTdHZGNC0yMVd1amU1RVhBQUFBQUxZVTRwNmNjUm1DTE9SQnBmUEVTdWpYYm9RVyZtaWQ9NjY2JnRocmVzaG9sZD0xNTAmdGlkPTRFN0VDNzRDMkM0NDdDQjVDNjUwOUJERkY1MzdEQ0ExJnNyY2lkPTExMiZ2ZXJubz0xWlo=
@panfu
panfu / weibo_ads_killer.js
Created December 29, 2011 07:32
weibo广告杀手,适用于Chrome。
// ==UserScript==
// @name 铲除一切害人虫
// @description 移除我想移除,留下我想留下
// @match http://weibo.com/*
// @match http://*.weibo.com/*
// @match http://t.sina.com.cn/*
// @version 1.0
// ==/UserScript==
// 在这里添加你想要去掉的dom的id
@cfx
cfx / gist:2036253
Created March 14, 2012 12:51
Y combinator in ruby
lambda { |m|
lambda { |f| f.call(f) }.call(
lambda { |f|
m.call(lambda { |x| f.call(f).call(x) })}) }
e.g
lambda { |m|
lambda { |f| f.call(f) }.call(
lambda { |f|
@HungYuHei
HungYuHei / Gemfile
Created October 19, 2012 01:41
followable with redis Sorted-Set
# Gemfile
gem 'redis', '~> 3.0.1'
@heckj
heckj / .cloudenvy
Created October 28, 2012 17:41
cloudenvy files for DevStack
cloudenvy:
keypair_name: heckj
keypair_location: /home/heckj/.ssh/id_dsa.pub
clouds:
env4:
os_auth_url: http://myopenstack.instance.com:5000/v2.0/
os_username: heckj
os_password: **********
os_tenant_name: heckj-project