This file contains 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
require 'rubygems' | |
require 'mongo' | |
module MongoPubSub | |
QUEUES_COLLECTION = 'queues' | |
class EndSubscriptionException < Exception; end | |
class Publisher | |
def initialize(queue_name, mongo_connection) | |
# Initialize queue collection as a capped collection | |
if not mongo_connection[QUEUES_COLLECTION].collection_names.include?(queue_name) |
This file contains 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
# Ubuntu upstart file at /etc/init/mongodb.conf | |
pre-start script | |
mkdir -p /var/lib/mongodb/ | |
mkdir -p /var/log/mongodb/ | |
end script | |
start on runlevel [2345] | |
stop on runlevel [06] |
This file contains 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
set :domain, ENV["domain"] | |
set :application, domain | |
set :user, ENV["user"] | |
set :destination, ENV["destination"] || domain | |
set :web_conf, ENV["web_conf"] || ENV["environment"] || 'production' | |
raise "please set domain=app.domain.name.com" unless domain | |
raise "please set user=server_username" unless user | |
set :port, ENV["port"] || 1234 | |
set :repository, "." |
This file contains 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
// Global configuration, may be overidden, configure will, under the hood, mix | |
// into the prototype. If you use configure within extending it will mix into | |
// the instance. | |
Backbone.LayoutManager.configure({ | |
// Specify the engine to use, should be a reference type, function/object/etc. | |
engine: _.template | |
}); | |
// Configure on a per layout basis, mixes into the instance | |
// Backbone.LayoutManager internally extends from Backbone.View |
This file contains 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
(function($) { | |
// Used by dateinput | |
$.expr = {':': {}}; | |
// Used by bootstrap | |
$.support = {}; | |
// Used by dateinput | |
$.fn.clone = function(){ | |
var ret = $(); |
This file contains 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
# want to nest `Video` under `Media`; had a `videos` collection | |
# rename the collection: | |
Mongoid.database.drop_collection('videos') | |
Mongoid.database.rename_collection('videos', 'media') | |
# or | |
Mongoid.database.collection('videos').rename('media') | |
# change the type of all the existing records |
This file contains 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
//= require jquery | |
//= require jquery_ujs | |
$(function() { | |
var source = new EventSource('/stream'); | |
source.addEventListener('counter', function(e) { | |
$('body').after(e.data + '<br />'); | |
}); | |
}); |
This file contains 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
require 'sinatra' | |
set server: :thin | |
get '/' do | |
erb :welcome | |
end | |
get '/stream', provides: 'text/event-stream' do | |
stream do |out| | |
loop do |
This file contains 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
# branch | |
$ git branch -d BRANCH # delete local BRANCH | |
$ git push origin :BRANCH # delete remote BRANCH | |
# tag | |
$ git tag -d TAG # delete local TAG | |
$ git push origin :refs/tags/TAG # delete remote TAG |
This file contains 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
#!/usr/bin/env node | |
var cordova_util = require('cordova/src/util'); | |
var projectRoot = cordova_util.isCordova(process.cwd()); | |
var projectXml = cordova_util.projectConfig(projectRoot); | |
var projectConfig = new cordova_util.config_parser(projectXml); | |
projectConfig.name(); | |
var fs = require ('fs'); |
OlderNewer