Skip to content

Instantly share code, notes, and snippets.

View MichaelSitter's full-sized avatar
🇨🇦

Michael Sitter MichaelSitter

🇨🇦
View GitHub Profile
package build
import java.net.InetSocketAddress
import play.sbt.PlayRunHook
import sbt._
object ProcessRunHookBuilder {
def apply(
base: File,
before: Option[String] = None,
@MichaelSitter
MichaelSitter / gist:7a1fc21422b25f141104
Created September 26, 2014 22:34
Jasmine spy promise strategies
// Add to boot.js
jasmine.SpyStrategy.prototype.returnResolvedPromise = function(promiseApi, resolvedValue) {
return this.callFake(function() {
var def = promiseApi.defer();
def.resolve(resolvedValue);
return def.promise;
});
};
jasmine.SpyStrategy.prototype.returnRejectedPromise = function(promiseApi, rejectValue) {
@MichaelSitter
MichaelSitter / gist:11385043
Last active August 29, 2015 14:00
Suggested jasmine style
require('yourModule', function (sut) {
var testValue, result;
describe('given testValue is 1', function () {
// ARRANGE
beforeEach(function () {
testValue = 1;
});
@MichaelSitter
MichaelSitter / gist:7379021
Created November 8, 2013 22:56
Simple querystring parser
define({
parse: function (querystring) {
if (querystring[0] === '?') {
querystring.substring(1, querystring.length);
}
var pairs = querystring.split('&'),
keys = {};
@MichaelSitter
MichaelSitter / gist:4179464
Created November 30, 2012 23:30
IIFE class declaration
(function (curator, backbone, _) {
var view = backbone.Marionette.ItemView.extend({
template: curator.Constants.Templates.FeedProductsGridTableRow,
tagName: 'tr',
attributes: function () {
return {
@MichaelSitter
MichaelSitter / gist:3505506
Created August 29, 2012 00:06
Prototyping dangers
(function (app) {
app.ProductSearchCollection = window.IQBackbone.ODataCollection.extend(
{
model: app.ProductSearchModel,
urlRoot:
function () { return Constants.SERVER_ROOT + '/odata/model/Products/Search'; },
urlParameters: ['$expand=Product'],
@MichaelSitter
MichaelSitter / gist:2656712
Created May 11, 2012 00:07
Testing in Nancy is so pretty!
[TestFixture]
public class EntityModuleTests
{
private static IEntityDataService fakeDataService;
private ConfigurableBootstrapper bootstrapper;
private Browser browser;
[SetUp]
public void Setup()
{