Skip to content

Instantly share code, notes, and snippets.

@fschwiet
fschwiet / phil-bios.md
Created December 28, 2011 05:27 — forked from haacked/phil-bios.md
Phil's Bios

I'm often asked to provide a bio, such as when speaking. I haven't been happy with what I've provided so far so I thought I'd try a few samples and see if I could get some feedback. :)

Bio 1 - the irreverent

Phil Haack is awful at writing speaker bios, hates referring to himself in the third person, but is good at doing what he's told. He works at GitHub bringing social coding, rainbows, and unicorns to .NET and Windows developers. Prior to GitHub, Phil worked at Microsoft shipping software such as ASP.NET MVC, NuGet, and other odds and ends.

Phil was a co-author of the infamous 4-forehead book on ASP.NET MVC and is a regular speaker at conferences around the world, but loves speaking at {{your conference here}} most of all!

For more about Phil, check out his blog at http://haacked.com/ or his Twitter account http://twitter.com/#!/haacked.

Bio 2 - the odd

public class EngageIdentity : IIdentity
{
private readonly string _name;
public EngageIdentity(string name)
{
_name = name;
}
public string Name
@fschwiet
fschwiet / gist:3037986
Created July 3, 2012 06:02
use SinonJS XHR to spy on outgoing AJAX requests - useful for debugging
// SinonJS's XHR support is great for unit testing code that makes
// AJAX requests. But you can also use it to measure AJAX requests
// made from production code if you insert the below code snippet.
// full docs here: http://sinonjs.org/docs/#server
sinon.useFakeXMLHttpRequest();
sinon.FakeXMLHttpRequest.useFilters = true;
sinon.FakeXMLHttpRequest.addFilter(function (method, url, async, username, password) {
@fschwiet
fschwiet / gist:5667135
Last active January 7, 2016 00:14
trying to use promises with phantomjs
var Q = require("q");
var phantom=require('node-phantom');
function promisify(nodeAsyncFn, context, modifier) {
return function() {
var args = args = Array.prototype.slice.call(arguments);
var defer = Q.defer()
args.push(function(err, val) {
@fschwiet
fschwiet / gist:5803151
Last active December 18, 2015 15:19
feedparser repro
var FeedParser = require('feedparser'), request = require('request'), endpoint = require('endpoint');
function runOne(url) {
console.log("starting " + url);
request(url, function(error, response, body) {
if (error !== null) {
console.log("error A " + error);
console.log("done with " + url);
var input = "e299a5205765204d616b652054756d6d792048617070792120e299a5"
var output = new Buffer(input.length / 2);
for(var i = 0; i < input.length / 2; i++) {
output[i] = parseInt(input.slice(i*2, i*2 + 2), 16);
}
console.log(output.toString('utf8'));
@fschwiet
fschwiet / gist:6627425
Last active December 23, 2015 11:19
Quick reference for Javascript's apply, call and related functions.
Function.prototype.apply(thisArg[, argsArray])
Function.prototype.call(thisArg[, arg1[, arg2[, ...]]])
Q.nfcall(FS.readFile, "foo.txt", "utf-8");
Q.nfapply(FS.readFile, ["foo.txt", "utf-8"]);
Q.ninvoke(FS, "readFile", "foo.txt", "utf-8");
Q.npost(FS, "readFile", ["foo.txt", "utf-8"]);
Q.nbind(FS.readFile, FS)("foo.txt", "utf-8");
@fschwiet
fschwiet / gist:7902608
Created December 10, 2013 23:55
How to simplify this code? Promises won't help, as leaving the stack causes the IndexedDB transactions to close.
function remix(recording, frameSwitches) {
var keyRanges = [];
var lastRecordingId = null;
var lastTimeRange = Number.MIN_VALUE;
frameSwitches.switches.forEach(function(frameSwitch) {
if (lastRecordingId !== null) {
@fschwiet
fschwiet / gist:8343378
Created January 9, 2014 22:34
just dreamin
<<someHypthoticalScriptCS command: inherit from GivenWhenThenFixture override Specify>>
var someDllPath = arrange(() => GetPathOfBinDeployed("SomeTestLibrary.dll"));
expect(() => File.Exists(someDllPath));
given("an AppDomain wrapper for a test DLL", delegate()
{
    var appDomainWrapper = arrange(() => new AppDomainWrapper(someDllPath));
@fschwiet
fschwiet / gist:05ffd75570755688cafff7cf3e2c62e6
Last active September 28, 2016 19:21
Experimenting with Reactive schedulers
Experiment code:
var emitter = new Subject<string>();
var schedulers = new[]
{
new KeyValuePair<string, IScheduler>("EventLoop", new EventLoopScheduler()),
new KeyValuePair<string, IScheduler>("RxApp.MainThreadScheduler", RxApp.MainThreadScheduler),
new KeyValuePair<string, IScheduler>("RxApp.TaskpoolScheduler", RxApp.TaskpoolScheduler),
};