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
// "Extend" the EventEmitter like this: | |
var EventEmitter = require('events').EventEmitter; | |
EventEmitter.prototype.once = function(events, handler){ | |
// no events, get out! | |
if(! events) | |
return; | |
// Ugly, but helps getting the rest of the function |
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
macro $let { | |
case ( $($id:ident = $val:expr) (,) ... ) $body => { | |
/*(function(){ | |
$(var $id = $val;) ... | |
var ____r = (function() $body)(); | |
return ____r; | |
})()*/ | |
(function ($id (,) ...) $body)($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
macro λ { | |
case $params $body => { | |
(function $params $body) | |
} | |
case $name:ident $params $body => { | |
(function $name $params $body) | |
} | |
} | |
var a = λ (a) { |
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
macro $K { | |
case ($literal) => { | |
(function(){ | |
return $literal; | |
}) | |
} | |
case (function $params $body) => { | |
(function(){ | |
return function $params $body; | |
}) |
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
Number.prototype.repeat = function(doSomething){ | |
var last = Math.floor(this); | |
var ret = new Array(last); | |
for(var i = 0; i < last; ++i){ | |
ret[i] = doSomething(); | |
} | |
return ret; | |
}; | |
// Example: |
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
// y-combinator | |
macro $y { | |
case ( $var ) => { | |
function(){ | |
return function(f){ | |
return f(f) | |
}(function(f){ | |
return $var(function(x){ | |
return f(f)(x); | |
}) |
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
# You MUST have sql management tools installed | |
# ("...dll", "...dll", "...dll") | foreach { [System.Reflection.Assembly]::LoadFile($_) } | |
# Load these. Probabily missing in GAC; load with absolute path | |
[System.Reflection.Assembly]::LoadFile("C:\Program Files (x86)\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.Smo.dll") | |
#[System.Reflection.Assembly]::LoadFile("C:\Program Files (x86)\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.ConnectionInfo.dll") | |
#[System.Reflection.Assembly]::LoadFile("C:\Program Files (x86)\Microsoft SQL Server\100\SDK\Assemblies\ | |
# Fill those: |
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
# Gzip | |
tar -zxf <archive_name.tar.gz> | |
# Bzip | |
tar -jxf <archive_name.tar.bz2> | |
# -z Gzip | |
# -x Extract | |
# -f use archive file |
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
du -h | |
# -h: Human readable sizes |
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
netsh http add urlacl url=http://127.0.0.1:7654/ user=DOMAIN\user |
OlderNewer