😶🌫️
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Chauffeur.TestingTools; | |
using Fluidity.Configuration; | |
using Fluidity.Data; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Umbraco.Core; | |
using Xunit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function async(async) { | |
return new Promise(res => | |
setTimeout(() => (console.log(async), res()), 1000) | |
); | |
} | |
async function await() { await async('hello'); } | |
await(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var add = function (x, y) { | |
return x + y; | |
}; | |
var log = console.log; | |
var add1 = add.length <= 1 ? add(1) : add.bind(null, 1); | |
var three = add1.length <= 1 ? add1(2) : add1.bind(null, 2); | |
var four = add.length <= [2].length + 1 ? add(2, 2) : add.bind(null, 2, 2); | |
log(three); | |
log(four); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let foo = (bar: 'a) -> | |
{ something: bar } | |
let baz = foo(1) | |
let baz2 = foo("a") | |
printf "bar: %d" baz.bar | |
printf "bar2: %s" baz2.bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//uses ClaySharp: http://clay.codeplex.com | |
//add the following usings | |
//using ClaySharp; | |
//using ClaySharp.Behaviors; | |
void Main() | |
{ | |
var foo = TypeMe<IFoo>(new { Id = 1, Name = "Aaron" }); | |
Console.WriteLine(foo.Id); | |
Console.WriteLine(foo.Name); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let runner = function (fn) { | |
if (typeof fn !== 'function') { | |
throw 'A generator function is expected'; | |
} | |
var done = false; | |
var gen = fn(); | |
var val; | |
while (!done) { | |
let obj = gen.next(val); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function List-RemoteGitBranches { | |
param ( | |
[Parameter(Mandatory=$true)] | |
[string] | |
$Filter | |
) | |
$branches = git branch -r | ?{ $_ -Match $filter } | |
$count = $branches.Length |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.filter('numbersWithoutTrailingZero', function ($filter) { | |
return function (input, decimalPlaces) { | |
if (input % 1) { | |
return $filter('number')(input, decimalPlaces); | |
} | |
return $filter('number')(input, 0); | |
}; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
var pi = typeof(Foo).GetProperty("Bar"); | |
Expression<Func<Foo, string>> x = f => f.Bar; | |
x.Dump(); | |
var p = Expression.Parameter(pi.DeclaringType, "f"); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//assumes that the hash you want and the repo are obtainable via closure scope | |
function findPrevious(commit, previousCommit) { | |
repo.load(commit.parents[0], function (err, obj) { | |
if (obj.type !== 'commit') { | |
console.error(obj); | |
throw 'Unexpected type returned'; | |
} | |
repo.load(obj.body.tree, function (err, tree) { | |
if (tree.type !== 'tree') { |