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
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA4HMAJcfOeQkAQFaMI0orbCPpPhm76/3EypNOpoOGXvN7oYJMVrJWdJ+g5zTLsouZA0YJlECTXVi+rDkNxjTCB97doLpYkKPBblsOjde/1XYfguOLtIfjQQ6XxRZSm8j+d75zjYZCW2Xply30f5XCQyVSmU5dZ+w8wtNQkz2hb1ijn2c6EhiiE6bPmGkXn8E+pxZG4b2ZwnN6gV99KcDNNv3PJW/A0Lwwdc6RuEuwS8j6/C52qxN9OahiKsjwyr6SaU07hkqwTlz5CWUaprRv99DDiQjEojw9fFzl/NzOhWhodMZw8hliKjNvwMAn8usmzpavXPjTiIMe56L+OrroBw== [email protected] |
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
var express = require('express'), | |
http = require('http'), | |
sys = require('sys'), | |
fs = require('fs'), | |
path = require('path'), | |
alfred = require('alfred'); | |
var app = express.createServer(); | |
app.set('views', __dirname + '/views'); |
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 'fiber' | |
class SimpleEm | |
def self.async_fetch(url) | |
f = Fiber.current | |
http = EventMachine::HttpRequest.new(url).get :timeout => 10 | |
http.callback { f.resume(http) } | |
http.errback { f.resume(http) } |
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
var http = require('http'), | |
express = require("express"), | |
sys = require("sys"), | |
io = require('socket.io'); | |
var app = express.createServer(); | |
app.set('view engine', 'jade'); | |
app.get("/", function(req, res){ |
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(doc) { | |
if(doc.expires && doc.status && (doc.status == 'live' || doc.status == 'active')){ | |
var expiryDate = doc.expires.split(/-/); // date format is dd, mm, yy | |
var expiresOn = new Date(expiryDate[0], expiryDate[1], expiryDate[2]); | |
var timeNow = new Date(); | |
log('Now '+ timeNow); | |
log('Expires '+ expiresOn); | |
if( timeNow.getTime() >= expiresOn.getTime()) | |
emit(doc.coupon_id, null); | |
} |
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
module CachingHelper | |
def self.included(claz) | |
claz.extend ClassMethods | |
end | |
module ClassMethods | |
def sf_cache(wrapped_method) | |
send(:around_filter, :cache_result) | |
end |
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
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAlVGztIM7TTYcmX36qwYSM9wvEutM10J5o6LIog4h9s0QeghBqzAgGL+mHopdE2xqIMJnmchTwiEn4I+8EJQBbY8T3eeQBMzOhuCMwupnidLgUJiDROB+PN8xNv/CDEFOnRmaYJEne2WpFWdzaiWGpoBSeJAtOBiu2XvmRncU4z9GrP22GAyQqIsT+S+54Mg2i5hcdAR4Qjx8aTBHv9Gj9+o2fCgVSQ4F1oHLlf8mJqmJ0jC+7DGjBnIw6NFU3IDX9bOfTTCIK+cWiv2hvs6Jx8K/7D48lydHlYvgPMmjpZKY1VusyaBN2b1dYybIVzisZAwD8YW5yfGL5wl/Q8PleQ== [email protected] |
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 'json' | |
redis = Redis.new | |
redis.subscribe(:vsagarv_channel) do |on| | |
on.subscribe do |channel, subscriptions| | |
puts "Subscribed to ##{channel} (#{subscriptions} subscriptions)" | |
end | |
on.message do |channel, message| |
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(doc) { | |
if (doc.type && doc.type === 'commission' && doc.affiliate_network && doc.begins && doc.ends) { | |
var current = doc.begins.split(/-/); | |
var ends = doc.ends.split(/-/); | |
var current_date = new Date(parseInt(current[0], 10), parseInt(current[1], 10) - 1, parseInt(current[2], 10) + 1); // javascript month starts at 0 | |
var ends_date = new Date(parseInt(ends[0], 10), parseInt(ends[1], 10) - 1, parseInt(ends[2], 10) + 1); // javascript month starts at 0 | |
while( current_date < ends_date){ | |
emit([doc.network, doc.provider, current_date.getFullYear(), current_date.getMonth()+1, current_date.getDate()], null); | |
current_date = new Date(current_date.getTime() + 86400000); | |
} |
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
Schema Migrations | |
* Master for writes Passive master(slave) for reads | |
* Kill all slave db connections. | |
* Mark slave readonly.(safety) | |
* Mark slave offline(for the application) | |
* Should make the application transparently/otherwise switch reads to master | |
* Run schema migration on slave. Have some coffee(hours) | |
* Let Slave Catch up with the master.(some hours) | |
* Bring the site down | |
* Kill all master db connections. |
OlderNewer