Skip to content

Instantly share code, notes, and snippets.

var winterbrk2015 = {
what: 'Web / Mobile Application Development Contest',
when: 'Nov 30, 2014 to Jan 15, 2015',
where: 'In the clouds',
why: 'You know why we do it, if not, check out http://startupbrk.com/'
prizes: '8K, 4K, 2K (not $$) and potentially more',
signupLink: 'https://docs.google.com/forms/d/1b1H2tthtQfShuoAVu_XIhapSiNWFok4uXrVPPHjigDg/viewform'
};
@vibgy
vibgy / labdata.js
Created July 1, 2015 18:53
Intel Lab Data analysis using Mongo. Get the data from http://db.csail.mit.edu/labdata/labdata.html and you can use these scripts to import them in mongo and learn to write aggregation queries against mongo.
var mongoose = require ("mongoose"); // The reason for this demo.
mongoose.set('debug', true);
// Here we find an appropriate database to connect to, defaulting to
// localhost if we don't find one.
var uristring =
process.env.MONGOLAB_URI ||
process.env.MONGOHQ_URL ||
'mongodb://localhost/iot';
@vibgy
vibgy / firebase-push-using-parse.js
Created August 15, 2015 00:20
Firebase connector to send Push notifications using Parse push notifications
var FirebaseTokenGenerator = require("firebase-token-generator");
var Firebase = require("firebase");
var async = require("async");
var steps = [];
var tokenGenerator = new FirebaseTokenGenerator("sdfsdfsdfsdfsdf");
var token = tokenGenerator.createToken({ uid: "uniqueId1", some: "arbitrary", data: "here" });
var ref = new Firebase("https://sdfsdfsdf.firebaseio.com/messages/xyz");
var Parse = require('node-parse-api').Parse;
@vibgy
vibgy / fcm-data-message-service-worker.js
Last active January 20, 2022 16:08
Angular Service and Service Worker Code to handle FCM data messages and to enable a click handler for notifications shown using showNotification
//
// serviceWorkerService.js
//
'use strict';
angular.module('myApp.serviceWorker', [])
.service('serviceWorkerService', ['$q', '$http', '$location', '$timeout',
function($q, $http, $location, $timeout) {
var noTokenError = new Error('No Instance ID token available');
var noPermissionError = new Error('Unable to get permission to notify');
/*
(2,4)
(1,3) -------- (7,8)
---------- -------
1 2 3 4 5 6 7 8
total covered length = 4-1 + 8-7 = 4
*/
var assert = require('assert');