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 / Trigger Flash Message
Created February 15, 2016 20:39
Using angular-flash
var id = Flash.create('success', '<strong>Well done!</strong> You successfully read this important alert message.', 5000, {
class: 'custom-class',
id: 'custom-id'
}, true);
@metalaureate
metalaureate / config.xml
Created March 31, 2016 14:34
For debugging
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<widget id="co.ifwe.heartbeat.app" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Heartbeat</name>
<description>
A minimal way to stay connected and feel loved.
</description>
<author email="simon@ifwe.co" href="http://ionicframework.com/">
if(we)
</author>
<content src="index.html"/>
function fixOrientation(url, cb) {
// this function takes an s3 image
// check if it needs to be rotated
// if so, it creates a new version rotated
// uploads to S3
// and passes the url back
var exif = require('exif').ExifImage;
var easyimg = require('easyimage');
var path = require('path'), fs = require('fs-extra'), request = require('request');
2016-11-13 08:33:12.083222 Hisgeogram[7447:1674757] [Accessibility] ****************** Loading GAX Client Bundle ****************
2016-11-13 08:33:12.145147 Hisgeogram[7447:1674757] Apache Cordova native platform version 4.1.1 is starting.
2016-11-13 08:33:12.145621 Hisgeogram[7447:1674757] Multi-tasking -> Device: YES, App: YES
2016-11-13 08:33:12.182653 Hisgeogram[7447:1674757] Using UIWebView
2016-11-13 08:33:12.183502 Hisgeogram[7447:1674757] [CDVTimer][handleopenurl] 0.043988ms
2016-11-13 08:33:12.184258 Hisgeogram[7447:1674757] [CDVTimer][intentandnavigationfilter] 0.708044ms
2016-11-13 08:33:12.184326 Hisgeogram[7447:1674757] [CDVTimer][gesturehandler] 0.029981ms
2016-11-13 08:33:12.223696 Hisgeogram[7447:1674757] [CDVTimer][photolibrary] 39.330006ms
2016-11-13 08:33:12.244399 Hisgeogram[7447:1674757] [CDVTimer][splashscreen] 20.635962ms
2016-11-13 08:33:12.245151 Hisgeogram[7447:1674757] [CDVTimer][keyboard] 0.671983ms
@metalaureate
metalaureate / heartbeat
Created June 15, 2022 19:00
Generate a heartbeat event every 10 seconds when page tab is active
const CURRENT_PAGE='homepage' // whatever current page and/or pod id is
const poller=(page) => {
console.log(page)
return setInterval(() => {
let faux_segment_event={
'event': 'pods_heartbeat',
'page': page,
'timestamp': new Date().toUTCString(),
}
console.log('❤️🩺',faux_segment_event)