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
// deploytonenyures.blogspot.com | |
//At the time of this writing (2014/07/22) this code only works in Firefox | |
//notice that at the time of this writing, Direct Proxies and Array.prototype.findIndex are only supported by Firefox | |
function OrderPreservingObject(initObj){ | |
var obj = { | |
orderedKeys: [], | |
forEach: function(actionFunc){ | |
//where actionFunc receives as parameters: item, key, tiedDic |
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
// deploytonenyures.blogspot.com | |
using System; | |
using System.IO; | |
using System.Threading; | |
enum Status | |
{ | |
NotStarted, | |
Running, |
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
// deploytonenyures.blogspot.com | |
// example of how to use of the FileCopyTaker class | |
// while running the copy, you can easily try to append lines to the file with just: echo myline >> file.txt | |
using System; | |
using System.IO; | |
using System.Collections.Generic; | |
using System.Threading; | |
using System.Web.Script.Serialization; |
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
//http://deploytonenyures.blogspot.fr/2014/10/canceling-functional-style-iteration.html | |
//function stopCondition(item, index, array) returns true to indicate stop | |
//function action(item, index, array) | |
Array.prototype.while = function(stopCondition, action){ | |
var curPos = 0; | |
while (curPos < this.length && !stopCondition(this[curPos], curPos, this)){ | |
action(this[curPos], curPos, this); | |
curPos++; | |
} |
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
#http://deploytonenyures.blogspot.fr/2014/10/methodmissing.html | |
package AroundProxy; | |
use strict; use warnings; | |
sub New { | |
my ($class, $targetObj, $interceptorFunc) = @_; | |
my $self = { | |
targetObj => $targetObj, | |
interceptorFunc => $interceptorFunc |
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
// http://deploytonenyures.blogspot.fr/2015/06/simulating-await-with-es6-generators.html | |
//as of node 0.12.4 we still need the -harmony flag to enable generators | |
var print = console.log; | |
//--------------------- | |
// class used to represent an asynchronous operation | |
//it's a sort of "poor man's" Promise |
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
package City; | |
use strict; | |
use warnings; | |
sub New | |
{ | |
my ($type, $name) = @_; | |
my $self = { | |
name => $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
// http://deploytonenyures.blogspot.fr/2015/11/es6-proxies-part-ii.html | |
//to run it in node.js 4 it should be just this flag: --harmony_proxies | |
//but does not seem to work, so run it in Firefox | |
var cat = { | |
name: "Kitty", | |
method1: function(msg){ | |
console.log("cat: " + this.name + ", method1 invoked with msg: " + msg); | |
this.method2(msg); | |
}, |
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 System; | |
using System.Collections.Generic; | |
namespace HttpClientAsyncTest | |
{ | |
public class ConsoleSpinner | |
{ | |
int pos; | |
List<string> items; | |
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
//http://blog.keithcirkel.co.uk/metaprogramming-in-es6-part-2-reflect/ | |
//http://stackoverflow.com/a/25585988 | |
function runTest(account){ | |
console.log("___________"); | |
console.log(account.totalSpent); | |
console.log("-----------"); | |
console.log(account.amountAvailable); | |
console.log("-----------"); | |
console.log("toString: " + account.toString()); |