Skip to content

Instantly share code, notes, and snippets.

@metalaureate
metalaureate / gist:5759105
Created June 11, 2013 17:51
Get gender prediction, but be nice about it.
// server.js - extracts gender using igender api
var _ = require('underscore');
var pg = require('pg'); //Postgres integration pg_ctl -D /usr/local/var/postgres -l logfile start
var request = require('request');
var async = require('async');
//Connect to database
var conString = "tcp://shill:@localhost:5432/swoon";
@metalaureate
metalaureate / mod_offline_email.lua
Created March 20, 2015 00:54
Adding vCard support
local jid_bare = require "util.jid".bare;
local os_time = os.time;
local t_concat = table.concat;
local smtp = require "socket.smtp";
local vcards = module:open_store("vcard");
local smtp_server = module:get_option_string("smtp_server", "localhost");
local smtp_user = module:get_option_string("smtp_username");
local smtp_pass = module:get_option_string("smtp_password");
local smtp_daemon = module:get_option_string("smtp_daemon");
local jid_bare = require "util.jid".bare;
local os_time = os.time;
local t_concat = table.concat;
local smtp = require "socket.smtp";
local vcards = module:open_store("vcard");
local smtp_server = module:get_option_string("smtp_server", "localhost");
local smtp_user = module:get_option_string("smtp_username");
local smtp_pass = module:get_option_string("smtp_password");
local smtp_daemon = module:get_option_string("smtp_daemon");
local jid_bare = require "util.jid".bare;
local jid_split = require "util.jid".split;
local os_time = os.time;
local t_concat = table.concat;
local smtp = require "socket.smtp";
local vcards = module:open_store("vcard");
local smtp_server = module:get_option_string("smtp_server", "localhost");
local smtp_user = module:get_option_string("smtp_username");
local smtp_pass = module:get_option_string("smtp_password");
local smtp_daemon = module:get_option_string("smtp_daemon");
function mutualSubscribe(source, friend, callback) {
var XMPP = require('stanza.io');
var friend_jid = new XMPP.JID(friend.toLowerCase() + '@idelog.me/daemon');
var source_jid = new XMPP.JID(source.toLowerCase() + '@idelog.me/daemon');
var source_client = XMPP.createClient({
jid: source_jid,
password: source.split("").reverse().join(""),
transport: 'bosh',
boshURL: config.get('xmpp.bosh_url')
function mutualSubscribe(source, friend, callback) {
var XMPP = require('stanza.io');
var friend_jid = new XMPP.JID(friend.toLowerCase() + '@idelog.me');
var source_jid = new XMPP.JID(source.toLowerCase() + '@idelog.me');
var source_client = XMPP.createClient({
jid: source_jid,
password: source.split("").reverse().join(""),
transport: 'bosh',
boshURL: config.get('xmpp.bosh_url')
function mutualSubscribe(source, friend, callback) {
var XMPP = require('stanza.io');
var friend_jid = friend.toLowerCase() + '@idelog.me';
var source_jid = source.toLowerCase() + '@idelog.me';
var source_client = XMPP.createClient({
jid: source_jid,
password: source.split("").reverse().join(""),
transport: 'bosh',
boshURL: config.get('xmpp.bosh_url')
function mutualSubscribe(source, friend, callback) {
var XMPP = require('stanza.io');
var friend_jid = friend.toLowerCase() + '@idelog.me';
var source_jid = source.toLowerCase() + '@idelog.me';
var source_client = XMPP.createClient({
jid: source_jid,
password: source.split("").reverse().join(""),
transport: 'bosh',
function mutualSubscribe(source, friend, callback) {
var XMPP = require('stanza.io');
var friend_jid = friend.toLowerCase() + '@xxxx.me';
var source_jid = source.toLowerCase() + '@xxxx.me';
var source_client = XMPP.createClient({
jid: source_jid,
password: 'xyz',
transport: 'bosh',
boshURL: config.get('xmpp.bosh_url')
@metalaureate
metalaureate / protractor mail-tester.js
Created April 29, 2015 18:59
var flow = protractor.promise.controlFlow(); console.log('starting test for email'); flow.execute(function () { return mail.waitForMail(protractor.promise.defer(), { username: '[email account login]', password: '[email account password]' }, "Validate",test_account.username, 60000) .then(function resolve(body) { console.log('email', body.text); v…
// Module dependencies.
var async = require('async');
var _ = require('underscore');
var application_root = __dirname,
path = require('path'); //Utilities for dealing with file paths
var request = require('request');
var Q = require('q');
var POP3Client = require("poplib");
var MailParser = require("mailparser").MailParser;