Skip to content

Instantly share code, notes, and snippets.

View towynlin's full-sized avatar

Zachary Crockett towynlin

View GitHub Profile
/**
* This script will automatically sync all updates from one database to another. It is meant to be run while
* syncing the database using mongodump and mongorestore.
*
* Example:
* node livesync.js mongodb://<user>:<pass>@dbhost.com:10645/app-production \
* mongodb://<user>:<pass>@dbhost.com:10499/local?authSource=app-production \
* app-production \
* mongodb://<user>:<pass>@newdbhost.com/app-prod
*/
@dmiddlecamp
dmiddlecamp / packetClient.js
Last active August 29, 2015 14:04
CC3000 failing reads at 256 byte boundaries
/**
* Created by middleca on 7/17/14.
*/
var when = require('when');
var settings = {
ip: "192.168.1.49",
port: 80,
start_size: 0,
end_size: 1024
@Hypnopompia
Hypnopompia / app.js
Last active August 29, 2015 14:01
Node app to listen for spark events and tweet the data
// To run, first install the twit and eventsource packages:
// npm install twit eventsource
// then:
// node app.js
// From the spark core, call:
// Spark.publish("tweet", "Hello Twitter. (Test post, please ignore)", 60, PRIVATE);
var EventSource = require('eventsource');
@andkerosine
andkerosine / raskell.rb
Created August 15, 2012 05:56
Haskell-like list comprehensions in Ruby
$stack, $draws = [], {}
def method_missing *args
return if args[0][/^to_/]
$stack << args.map { |a| a or $stack.pop }
$draws[$stack.pop(2)[0][0]] = args[1] if args[0] == :<
end
class Array
def +@
@robotmay
robotmay / delayed_devise_mailer.rb
Created November 2, 2010 11:34
A quick hack to make Devise send its confirmation/password reset/unlock emails via delayed_job. Chuck the following in a file under config/initializers
module Devise
module Models
module Confirmable
handle_asynchronously :send_confirmation_instructions
end
module Recoverable
handle_asynchronously :send_reset_password_instructions
end