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');
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 / 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">
var mySubmitFunc = function(error, state){
if (!error) {
if (state === "signIn") {
console.log('signed in...');
// Successfully logged in
// ...
}
if (state === "signUp") {
console.log('signed up...');
// Successfully registered
@jxm262
jxm262 / implementation
Last active October 6, 2015 02:48
helping friend on slack
alert('hello');
//var logger = "http://localhost:3000/";
//
//function createCORSRequest(method, url) {
// /* function to create a Cross Origin Resource Sharing Request to another domain.
// * Does not send the request.
// * @param http method of the request.
// * @param url the address we wish to send the request to.
// * @param return the open request to the url, unsent.
// */
@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);