Skip to content

Instantly share code, notes, and snippets.

View aaronpowell's full-sized avatar
😶‍🌫️

Aaron Powell aaronpowell

😶‍🌫️
View GitHub Profile
@aaronpowell
aaronpowell / gist:3647219
Created September 5, 2012 23:10
INPC bubble
public class Something : INotifyPropertyChanged {
private bool foo;
public bool Foo {
get {
return foo;
}
set {
if(foo == value) return;
@aaronpowell
aaronpowell / .gitconfig
Last active October 7, 2015 12:07 — forked from shiftkey/merge-local-branches.ps1
Script to cleanup merged branches locally
[alias]
cb = "!f() { git branch --merged | grep -v "master" | while read i; do git branch -d $i; done; }; f"
@aaronpowell
aaronpowell / postman.min.js
Created May 17, 2012 23:05
Postman minified but with whitespace preserved
(function () {
var a, b, c;
a = function () {
function a() {
this.first = null, this.last = null, this.length = 0
}
a.prototype.append = function (a) {
var b;
if ( !! a) {
b = {
@aaronpowell
aaronpowell / License.md
Created May 16, 2012 07:18
A useful exception for when you don't want to implement a feature yourself

The MIT License

Copyright (c) 2012 Aaron Powell

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWA

var Person = function (name) {
if (!name) throw new Error("The 'name' parameter is required.");
this.sayHello = function () {
console.log('Hello ' + name);
}
};
@aaronpowell
aaronpowell / HelloWorld.cs
Created March 14, 2012 00:27
A simple hello world OWIN + Gate + Firefly app
namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
var builder = new AppBuilder();
var app = builder.Build(Startup.Configuration);
var server = new ServerFactory().Create(app, 1337);
@aaronpowell
aaronpowell / read-packages.js
Created February 21, 2012 05:41
Read packages
var fs = require('fs');
var packages = [];
var readPackage = function (file) {
if (file === '.bin') {
return;
}
var pkg;
@aaronpowell
aaronpowell / fiddle.js
Created November 27, 2011 10:06
Q18 - Powerful properties
var obj = Object.freeze({ foo: 'bar' });
Object.defineProperty(obj, 'foo', { value: 'baz' });
@aaronpowell
aaronpowell / fiddle.js
Created November 20, 2011 10:32
Q17 - Really negative
var fn = function(x) {
return (1/x) === -Infinity;
};
@aaronpowell
aaronpowell / fiddle.js
Created October 31, 2011 01:30
Q15 - What's the index?
var foo = 'abcd';
if ( foo.indexOf('a') >= 0 ) {
console.log ( 'we have a match!' );
} else {
console.log ( 'this is not the value you\'re looking for' );
}