var dummySocket = new ReadWriteNetStream();
// Debug
dummySocket.on('data', function(data){
console.log('write received', data);
});
dummySocket.write('hey !');
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 python | |
import redis | |
import random | |
import pylibmc | |
import sys | |
r = redis.Redis(host = 'localhost', port = 6389) | |
mc = pylibmc.Client(['localhost:11222']) |
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
stuff1 = function(deferred) { | |
setTimeout(function() { | |
console.log("Stuff #1 is done!"); | |
deferred.resolve(); | |
}, 1000); | |
}; | |
stuff2 = function(deferred) { | |
setTimeout(function() { | |
console.log("Stuff #2 is done!"); |
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
stuff1 = function(deferred) { | |
setTimeout(function() { | |
console.log("Stuff #1 is done!"); | |
deferred.resolve(); | |
}, 1000); | |
}; | |
stuff2 = function(deferred) { | |
setTimeout(function() { | |
console.log("Stuff #2 is done!"); |
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
#add 'node_modules' to .gitignore file | |
git rm -r --cached node_modules | |
git commit -m 'Remove the now ignored directory node_modules' | |
git push origin <branch-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
var connectionString = 'postgres://localhost:5432/postgres'; | |
var Promise=require('bluebird'); | |
var knex = require('knex')({ | |
client: 'pg', | |
connection: { | |
user: 'postgres', | |
database: 'postgres', | |
port: 5432, |
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
'use strict'; | |
var Promise = require('bluebird'); | |
var knex = require('../../src/db').knex; | |
var tables = [ | |
'organizations', | |
'campaigns', | |
'donors', | |
'pledges', |
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
Model:: | |
/*Select*/ | |
select('col1','col2') | |
->select(array('col1','col2')) | |
->select(DB::raw('businesses.*, COUNT(reviews.id) as no_of_ratings, IFNULL(sum(reviews.score),0) as rating')) | |
->addSelect('col3','col4') | |
->distinct() // distinct select | |
/*From*/ |
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 nodemailer = require('nodemailer'); | |
var sesTransport = require('nodemailer-ses-transport'); | |
var smtpPassword = require('aws-smtp-credentials'); | |
var mailOptions = { | |
from: 'from@example.com', | |
to: 'to@example.com', | |
text: 'This is some text', | |
html: '<b>This is some HTML</b>', | |
}; |
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
while read r; do | |
echo $r | |
aws codecommit delete-repository --repository-name $r --region us-east-1 | |
done < ~/dev/utility-scripts/aws/codecommit/repos.txt |
OlderNewer