Skip to content

Instantly share code, notes, and snippets.

@shanefulmer
shanefulmer / CorsHandler.cs
Created November 30, 2012 04:49
CorsHandler
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
namespace DotNetOpenAuth.WebAPI {
public class CorsHandler : DelegatingHandler {
const string Origin = "Origin";
const string AccessControlRequestMethod = "Access-Control-Request-Method";
UUID uuid = UUID.randomUUID();
function One() {
this.a = function () {
return this.b();
}
}
function b() {
return 1;
}
@shanefulmer
shanefulmer / gist:6198848
Created August 10, 2013 03:03
Secrets of the JavaScript Ninja pg 53-54
function Ninja() {
this.skulk = function () { return this; };
}
var whatever = Ninja();
console.log(whatever);
"But the effect would be for the skulk property to be created on window, and for window to be returned and stored in whatever"
@shanefulmer
shanefulmer / delivery.js
Created September 10, 2013 19:07
Next delivery date
require('sugar');
var _und = require('underscore');
function getDeliveryDate() {
// really only need holidays that are on Friday
var holidays = ['11/29/2013','12/25/2013', '11/28/2014'];
var startDate = '10/4/2013';
var deliveryDates = _und.range(100).map(function (i) {
var deliveryDate = Date.create(startDate).advance({weeks: 2 * i});
@shanefulmer
shanefulmer / cs.snippets
Last active April 24, 2018 18:55
C# Snipmate Snippets
# cs.snippets
# ===========
#
# Standard C-Sharp snippets for snipmate.
#
# Largely ported over from Visual Studio 2010 snippets plus
# a few snippets from Resharper plus a few widely known snippets.
#
# Most snippets on elements (i.e. classes, properties)
# follow suffix conventions. The order of suffixes to a snippet