This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Kind of like tail -f -n1 | |
db = Mongo::Connection.new(mongo_hostname).db(mongo_dbname) | |
coll = db.collection(mongo_collection) | |
start_count = coll.count | |
tail = Mongo::Cursor.new(coll, :tailable => true, :order => [['$natural', 1]]).skip(start_count- 1) | |
loop do | |
if doc = tail.next_document | |
puts doc | |
else | |
sleep 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# LoremHelper - a placeholder content generator for Webby | |
# ======================================================= | |
# based on Travis Dunn's Frank - lorem.rb: | |
# - https://github.com/blahed/frank/blob/master/lib/frank/lorem.rb | |
# - original license: https://github.com/blahed/frank/blob/master/LICENSE | |
# | |
# LoremHelper creates placeholder content for your Webby [http://webby.rubyforge.org/] projects. | |
# It's great for quickly prototyping/wireframing a site. | |
# | |
# USAGE: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
As of version 1.1.2, Propane will load and execute the contents of | |
~Library/Application Support/Propane/unsupported/caveatPatchor.js | |
immediately following the execution of its own enhancer.js file. | |
You can use this mechanism to add your own customizations to Campfire | |
in Propane. | |
Below you'll find two customization examples. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mongoid.database.add_stored_function "sequence", <<-__ | |
function(name) { | |
var ret = db.counters.findAndModify({ query: { _id: name}, update: { $inc : { next: 1}}, "new" :true, upsert: true}); | |
return ret.next; | |
} | |
__ | |
class Sequence | |
include Mongoid::Fields::Serializable |
A utility inspired by @ahoward that allows screens to be the name of the directory they were spawned from. This is mainly helpful for Terminal/iTerm tabs.
Executing this should rejoin sessions with the same name if they already exist or otherwise create them.
- Place or symlink into your path (I symlink as
ns
) - Ensure the script is executable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def console!(&block) | |
require 'pry' | |
Pry.config.hooks.send(:hooks).keys. | |
each{|which| Pry.config.hooks.clear(which)} | |
prompt = ">> " | |
Pry.config.prompt = proc{|*a| prompt } | |
block.binding.pry |
Couldn't find the text of this for a while...
OlderNewer