Skip to content

Instantly share code, notes, and snippets.

View joshbedo's full-sized avatar
🤙

Josh Bedo joshbedo

🤙
View GitHub Profile
@joshbedo
joshbedo / collection_path
Created May 15, 2014 23:43
Backbone collection url() snippet
test = {
urlRoot: "http://google.com",
url: function(options) {
var path;
if(options && options.param && options.query) {
path = "?" + options.param + "=" + options.query;
}
return (path) ? this.urlRoot + path : this.urlRoot;
}
while true; do sleep 1; curl http://www.google.com; echo -e '\n\n\n\n'$(date);done
@joshbedo
joshbedo / setjdk.sh
Created September 22, 2014 14:02
Aliases for different Java SDKs
export PATH=/usr/local/bin:$PATH
export JAVA_6_HOME=$(/usr/libexec/java_home -v 1.6)
export JAVA_8_HOME=$(/usr/libexec/java_home -v 1.8)
export MYSQL_PORT=3306
export SMTP_SERVER=smtp.gmail.com
export SMTP_PORT=587
export SMTP_DOMAIN=gmail.com
export [email protected]
export SMTP_PASSWORD=password
export SMTP_ENABLE_STARTTLS_AUTO=true
@joshbedo
joshbedo / jquery_promise.coffee
Last active August 29, 2015 14:07
jQuery's not so great API for promises
post: (endpoint, params = {})->
defer = $.Deferred()
$.when(
@requestChallenge()
).then(
(res) =>
@authChallenge(res)
,
(res) =>
@joshbedo
joshbedo / express.js
Created October 21, 2014 20:26
express example
var express = require('express'),
bodyParser = require('body-parser'),
app = express(),
port = process.env.PORT || 1337;
app.use(bodyParser.urlencoded({
extended: true
}));
var router = express.Router();
# Event handlers
#
# Example usage: App.request 'fetch:bundles'
# returns a promise so you can do this
#
# bundles or= App.request 'fetch:bundles'
# bundles.done (data) =>
API =
getBundleEntities: ->
@joshbedo
joshbedo / promises
Created October 30, 2014 04:25
Promises
var promoPromise;
if (promo_id) {
promoPromise = Promise.resolve(promo_id);
} else {
promoPromise = request('campaign', campaign_id)
.then(function(campaign) {
return campaign.get('promo_id');
});
}
promoPromise.then(function(promo_id) {
Feature: Displaying a Panel Image Banner on the Product List Page
So that PINCHME can deliver advertising messages and fill the page with content when there are few samples available
Members need to be able to see an advertising tile banner sections on the product list page that can be
turned on and off by an admin
Background:
Given I am signed in as a user
Scenario: Product List Page with no Panel Image Banners
Given there are 9 campaigns
@joshbedo
joshbedo / mixins
Created January 16, 2015 23:46
Mixins
var Class = function() {
this.initialize.apply(this, arguments);
};
_.extend(Class, {
extend: Backbone.View.extend,
inherit: function() {
var ret = this;
_.each(_.toArray(arguments), function(object) {