This file contains hidden or 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
{"lastUpload":"2017-05-04T19:44:30.519Z","extensionVersion":"v2.7.0"} |
This file contains hidden or 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
{- | |
Implementation of "Heathrow to London" algorithm | |
from a task in the book "Learn you a Haskell" | |
http://learnyouahaskell.com/functionally-solving-problems | |
Example input: | |
``` | |
$ echo "50 10 30 5 90 20 40 2 25 10 8 0 " | tr ' ' '\n' | runhaskell heathrow-to-london.hs | |
``` |
This file contains hidden or 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
import { OpaqueToken } from '@angular/core'; | |
import { Subject } from 'rxjs/Subject'; | |
import 'rxjs/add/operator/do'; | |
import 'rxjs/add/operator/scan'; | |
import 'rxjs/add/operator/observeOn'; | |
import { queue } from 'rxjs/scheduler/queue'; | |
import { ReplaySubject } from 'rxjs/ReplaySubject'; | |
export interface Action { | |
type: string; |
This file contains hidden or 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
// inspired by this http://stackoverflow.com/a/12506613 | |
// + emit SIGINT, and handle "exit" event | |
var stdin = process.stdin; | |
// without this, we would only get streams once enter is pressed | |
stdin.setRawMode( true ); | |
// resume stdin in the parent process (node app won't quit all by itself | |
// unless an error or process.exit() happens) |
This file contains hidden or 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
// type declaration | |
var A = makeType({ | |
init: function(x, y){ | |
this.x = x; | |
this.y = y; | |
}, | |
hello: function(){ | |
console.log(this.x, this.y) | |
} |
This file contains hidden or 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
// type declaration | |
var A = makeType({ | |
init: function(x, y){ | |
this.x = x; | |
this.y = y; | |
}, | |
hello: function(){ | |
console.log(this.x, this.y) | |
} |
This file contains hidden or 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 addMethod(object, name, fn){ | |
// Save a reference to the old method | |
var old = object[ name ]; | |
// Overwrite the method with our new one | |
object[ name ] = function(){ | |
// Check the number of incoming arguments, | |
// compared to our overloaded function | |
if ( fn.length == arguments.length ) | |
// If there was a match, run the function |
This file contains hidden or 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
JavaScript learning resources. | |
Starting point for those, who have already learned JS, but forgotten. Good article. Quite compact. | |
https://developer.mozilla.org/en/JavaScript/A_re-introduction_to_JavaScript | |
Question: what's the best learning source on JS. Some answers. | |
http://stackoverflow.com/questions/11246/best-resources-to-learn-javascript | |
http://stackoverflow.com/questions/2687566/learning-javascript-in-one-weekend | |
http://net.tutsplus.com/tutorials/javascript-ajax/the-best-way-to-learn-javascript/ |
This file contains hidden or 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
[TestFixture] | |
public class TimeToLiveTests | |
{ | |
[Test] | |
public void never_expiring_ttl_should_not_expire_at_relative_time() | |
{ | |
TimeToLive.CreateNeverExpiring().ExpiresAtRelativeTime.Should().BeFalse(); | |
} | |
[Test] |
This file contains hidden or 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
public class TreeAnalyzer | |
{ | |
public Node FindCommonRoot(IEnumerable<Node> nodes) | |
{ | |
var walkedNodes = new HashSet<Node>(); | |
var branches = nodes.ToList(); | |
int nextIterationBranchRangeStartIndex = 0; | |
do | |
{ | |
for (int i = nextIterationBranchRangeStartIndex; i < branches.Count; i++) |