Skip to content

Instantly share code, notes, and snippets.

View jxm262's full-sized avatar
🏠
Working from home

Justin Maat jxm262

🏠
Working from home
  • Columbus, OH
View GitHub Profile
package daos
import scala.concurrent.ExecutionContext
import scala.concurrent.Future
import play.api.Play.current
import play.modules.reactivemongo._
import reactivemongo.api._
import reactivemongo.api.indexes._
import reactivemongo.bson._
import reactivemongo.bson.handlers.BSONReader
package core.dao
import scala.concurrent.Future
import play.api.Logger
import reactivemongo.core.commands.LastError
import reactivemongo.core.errors.DatabaseException
import core.db.MongoHelper
/**
* Todo: have no idea if this is the best way to organize this, please pm for
* suggestions
*/
var xchange = require('../xchange.js')
,assert = require("assert")
,chai = require('chai')
,sinon = require('sinon')
,expect = chai.expect;
@jxm262
jxm262 / gist:c32cf5ede3c1d5e4bfd6
Created January 26, 2015 15:15
using request library directly, works fine
var request = require("request");
var apis = {bitfinex: "https://api.bitfinex.com/v1/pubticker/btcusd",
bitstamp: "https://www.bitstamp.net/api/ticker/"};
async.map([ "bitfinex", "bitstamp"],
function(item, callback) {
request(apis[item], function(err,resp, body) {
return callback(err, body);
});
(function () {
//Used for jsx to js transformations during mocha tests
require('./test/configs/jsxcompiler.js');
var gulp = require('gulp');
var gutil = require('gulp-util');
var nodemon = require('gulp-nodemon');
var less = require('gulp-less');
var rimraf = require('rimraf');
@jxm262
jxm262 / bluebirdCancel.js
Last active November 20, 2020 13:45
Bluebird - chained promises cancel() example
function a (obj) {
return new Promise(function (res, rej) {
res(obj);
});
};
function chainingClosure(start){
console.log('starting regular bluebird promise example...');
var p = a(start)
@jxm262
jxm262 / superagent_bluebird.js
Last active June 6, 2016 17:18
SuperAgent + Bluebird.js
var Promise = require('bluebird'), 

superagent = Promise.promisifyAll(require('superagent'));
superagent.Request.prototype.cancellable = function () {

return this.endAsync().cancellable();
};



superagent.Request.prototype.then = function (done) {

return this.endAsync().then(done);

var Promise = require('bluebird');
var superagent = Promise.promisifyAll(require('superagent'));
function a(obj) {
return superagent
.get('http://google.com')
.endAsync();
};
function chainingClosure(start) {
@jxm262
jxm262 / gulp-istanbul-example.js
Last active June 1, 2020 14:26
gulp-istanbul-example
(function () {
var gulp = require('gulp');
var mocha = require('gulp-mocha');
var istanbul = require('gulp-istanbul');
//moved these to functions instead of gulp
function test(cb) {
gulp.src(['test/**/*.js'])
.pipe(istanbul({includeUntested: true})) // Covering files
@jxm262
jxm262 / map.html
Created May 23, 2015 16:00
Meteor-Google-Maps with custom control example
<template name="map">
<div class="map-container" style="width: 100%; max-width: 100%; height: 500px;">
{{> googleMap name="mymap" options=mapOptions}}
</div>
</template>
<!--Want to put Center Map component in separate template-->
<template name="CenterMapComponent">
<div id="controlDiv">