Skip to content

Instantly share code, notes, and snippets.

View serby's full-sized avatar
😃
Joyful

Paul Serby serby

😃
Joyful
View GitHub Profile
@serby
serby / gist:956157
Created May 4, 2011 22:19
maiden bash completion
_maiden()
{
local cur prev opts
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="-h -l -b -v -q"
if [ -e "Maiden.php" ]
then
targets=`echo ""| maiden -b | sort -u`
COMPREPLY=( $(compgen -W "${targets}" -- ${cur}) )
@serby
serby / gist:1200356
Created September 7, 2011 11:42
Nodemail Example to Hotmail
var
nodemailer = require('nodemailer');
nodemailer.sendmail = true;
var mail = {
subject: 'HTML Email Test',
html: '<p>Test <strong>Email</strong></p>',
body: 'Test Email',
sender: '[email protected]'
@serby
serby / gist:1205774
Created September 9, 2011 08:37
Showing the nodemailer global send engine bug
function first() {
var nodemailer = require('nodemailer');
console.log(nodemailer.sendmail);
console.log(nodemailer.SMTP);
}
function second() {
var nodemailer = require('nodemailer');
$('input[name=Basic]').placeholder('Email Address');
Mar 9 13:12:37 srv-s1sr6 init: bouncy (Node - Clock WebsitSite) main process (15733) terminated with status 1
Mar 9 13:13:15 srv-s1sr6 init: bouncy (Node - Clock WebsitSite) main process (15748) terminated with status 1
Mar 9 13:13:27 srv-s1sr6 init: bouncy (Node - Clock WebsitSite) main process (15763) terminated with status 1
Mar 9 13:15:53 srv-s1sr6 init: bouncy (Node - Clock WebsitSite) main process (15770) terminated with status 1
Mar 9 13:15:53 srv-s1sr6 init: bouncy (Node - Clock WebsitSite) main process ended, respawning
Mar 9 13:16:57 srv-s1sr6 init: bouncy (Node - Clock WebsitSite) main process (15835) terminated with status 1
Mar 9 13:16:57 srv-s1sr6 init: bouncy (Node - Clock WebsitSite) main process ended, respawning
Mar 9 13:17:01 srv-s1sr6 CRON[15841]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Mar 9 13:21:13 srv-s1sr6 init: bouncy (Node - Clock WebsitSite) main process (15837) terminated with status 1
Mar 9 13:21:13 srv-s1sr6 init: bouncy (Node - Clock WebsitSite) ma
Mar 9 17:00:07 srv-s1sr6 init: bouncy (Node - Clock WebsitSite) main process (15987) terminated with status 1
Mar 9 17:00:07 srv-s1sr6 init: bouncy (Node - Clock WebsitSite) main process ended, respawning
Mar 9 17:01:26 srv-s1sr6 init: bouncy (Node - Clock WebsitSite) main process (15989) terminated with status 1
Mar 9 17:01:26 srv-s1sr6 init: bouncy (Node - Clock WebsitSite) main process ended, respawning
Mar 9 17:01:28 srv-s1sr6 init: bouncy (Node - Clock WebsitSite) main process (15991) terminated with status 1
Mar 9 17:01:28 srv-s1sr6 init: bouncy (Node - Clock WebsitSite) main process ended, respawning
Mar 9 17:02:54 srv-s1sr6 init: bouncy (Node - Clock WebsitSite) main process (15993) terminated with status 1
Mar 9 17:02:54 srv-s1sr6 init: bouncy (Node - Clock WebsitSite) main process ended, respawning
Mar 9 17:15:13 srv-s1sr6 init: bouncy (Node - Clock WebsitSite) main process (15995) terminated with status 1
Mar 9 17:15:13 srv-s1sr6 init: bouncy (Node - Clock WebsitSite) main process ended,
echo deb http://ftp.us.debian.org/debian/ sid main >> /etc/apt/sources.list.d/sid.list
apt-get -qy install python-software-properties
add-apt-repository ppa:chris-lea/node.js
apt-get -qy update
apt-get -qy install nodejs
curl http://npmjs.org/install.sh | sh
node --version
npm install -g n
apt-get -qy install build-essential
apt-get -qy install libssl-dev
@serby
serby / gist:2253807
Created March 30, 2012 18:33
JavaScript Developer
@serby
serby / sync.js
Created May 23, 2012 14:19
JavaScript implementation of set synchronisation. Bound by memory but minimizes database read writes.
var _ = require('underscore')
, a = {
1: { id: '1', name: 'a' },
2: { id: '2', name: 'b' },
3: { id: '3', name: 'c' }
}
, b = {
2: { id: '2', name: 'b1' },
3: { id: '3', name: 'c2' },
4: { id: '4', name: 'd' }
var
Db = require('mongodb').Db,
Connection = require('mongodb').Connection,
ReplSetServers = require('mongodb').ReplSetServers,
Server = require('mongodb').Server;
module.exports.createDatabaseAdaptor = function(properties, serviceLocator) {
var
serverData,