Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am mwjackson on github.
  • I am mwjackson (https://keybase.io/mwjackson) on keybase.
  • I have a public key whose fingerprint is 7850 E420 1BD3 4BA1 CED7 7B64 DBB8 1926 0183 C2A3

To claim this, I am signing this object:

@mwjackson
mwjackson / gist:d87e0d89a38118eeb5b1
Created October 12, 2014 19:13
state updates, props not?
/** @jsx React.DOM */
var CommentBox = React.createClass({
loadCommentsFromServer: function() {
$.ajax({
url: '/data/',
dataType: 'json',
success: function(data) {
this.setState({commentData: data});
}.bind(this),
error: function(xhr, status, err) {
@mwjackson
mwjackson / gist:4475177
Created January 7, 2013 13:58
SM init code
public class StructureMapConfiguration
{
public static void Initialise(IEnumerable<Assembly> assembliesToScan, params Action<IInitializationExpression>[] extraConfigs)
{
ObjectFactory.Initialize(config =>
{
config.Scan(scan =>
{
foreach(var assembly in assembliesToScan)
{
@mwjackson
mwjackson / c#
Created July 30, 2012 20:36
mvc routes in your clientside codez
// first register all your routes with names
MapRouteWithName(routes,
"Homepage", // Route name
"home", // URL with parameters
new {controller = "Home", action = "Index"} // Parameter defaults
);
private static void MapRouteWithName(RouteCollection routes, string name, string url, object defaults)
{
var route = routes.MapRoute(name, url, defaults);
@mwjackson
mwjackson / gist:3118265
Created July 15, 2012 19:28
extending backbone.js with an explicit controller
/*
Extending Backbone.js with a Controller class to place logic not belonging in either Models or Views
*/
Backbone.Controller = function (options) {
this.model = (options && options.model) || {};
};
var controllerMixin = _.pick(Backbone.Model, "extend", "constructor");
_.extend(Backbone.Controller, controllerMixin);
@mwjackson
mwjackson / gist:1566309
Created January 5, 2012 17:43
run iterations of msbuild and record avg time
#!/usr/bin/env python
from datetime import datetime
import subprocess
starttime = datetime.now()
print "start time:", starttime
numIterations = 1
@mwjackson
mwjackson / .gitconfig
Created October 19, 2011 11:14
p4merge with git (msysgit)
[diff]
tool = p4merge
[difftool "p4merge"]
path = C:/Program Files/Perforce/p4merge.exe
[merge]
summary = true
tool = p4merge
[mergetool "p4merge"]
path = C:/Program Files/Perforce/p4merge.exe
keepBackup = false