Skip to content

Instantly share code, notes, and snippets.

View joshbedo's full-sized avatar
🤙

Josh Bedo joshbedo

🤙
View GitHub Profile
//include lo-dash for averaging hover times and loops
//include benchmark.js for testing function runtimes
//make tags more versatile and use indexOf to see if the tag exists
console.time("executeTime");
var StoreStats = (function($, window, document) {
"use strict";
var scope = document.querySelectorAll(".storeStats"),$scope = $(scope),
socket = io.connect("http://ec2-54-184-116-0.us-west-2.compute.amazonaws.com:3000/"),
String details = "7\"";
details = details.replace("\""," inch");
System.out.println(details); // 7 inch
@joshbedo
joshbedo / http.js
Created February 9, 2014 23:19 — forked from bsstoner/http.js
/**
* Modified version of TJ's http support file from the Express repo:
* https://github.com/visionmedia/express/blob/master/test/support/http.js
*
* Module dependencies.
*/
var EventEmitter = require('events').EventEmitter
, should = require('should')
, methods = ['get','post','put','delete','head']
var express = require('express'),
app = express(),
server = require('http').createServer(app);
io = require('socket.io').listen(server),
crypto = require('crypto'),
uuid = require('node-uuid'),
geoip = require('geoip-lite'),
storeStats = require('./storeStats.js'),
api = require('./api/api-endpoints');
var express = require('express'),
app = express(),
server = require('http').createServer(app);
io = require('socket.io').listen(server),
jwt = require("jwt-simple"),
secret = "dgv33rggr3ewsfsf23gf2grwrf",
crypto = require('crypto'),
uuid = require('node-uuid'),
geoip = require('geoip-lite'),
storeStats = require('./storeStats.js'),
this.loginUser = function(user, callback) {
//plans for changing this to promises once i do error reporting
// var q = Q.defer();
// if() {
// q.resolve(num+1);
// } else {
// q.reject("error message");
// }
// return q.promise;
#!/bin/bash
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
###############################################
# To use:
# wget https://raw.github.com/gist/2776679/04ca3bbb9f085b192f6aca945120fe12d59f15f9/install-redis.sh
# chmod 777 install-redis.sh
# ./install-redis.sh
###############################################
echo "*****************************************"
@joshbedo
joshbedo / localStorageSync
Created May 2, 2014 22:10
localStorageSync.coffee
#storing collections like surveys, past products and other things
#when possible to reduce network requests and make things more snappy
#overriding sync to use local storage when possible
class Backbone.localStorageSync extends Backbone.Model
@sync = (method, model, options) ->
_.defaults(options || (options = {}), {
add: true
})
@joshbedo
joshbedo / infinite_scroll.coffee
Created May 6, 2014 18:12
Marionette infinite scrolling rows
@PM.module 'Layouts', (Layouts, App, Backbone, Marionette) ->
class Layouts.FeedbackLayout extends Layouts.CompositeList
className: 'row feedback composite-list-wrapper max-container'
template: 'feedback/feedback'
historyIndex: 1
initialize: ->
@addRegions({
productHistory: '.product-history-container'
})
@joshbedo
joshbedo / boom.coffee
Created May 9, 2014 23:57
fetching an endpoint
fetchPromise: (endpoint, params = {})->
deferred = $.Deferred (d)=>
@fetch endpoint, params, (res)->
d.resolve res
,
(res) ->
d.reject res
deferred.promise()