View source-git-completion.bash
gitRootDir=$(dirname $(git --info-path))/..
source $(find $gitRootDir -name git-completion.bash)
source $(find $gitRootDir -name git-prompt.sh)
View gist:8356567

Why does this work...

$ curl http://$auth@registry.npmjs.org/-/user/org.couchdb.user:isaacs
{"_id":"org.couchdb.user:isaacs","_rev":"93-157a5d9f44f3ef8fe6b21380632becf1","name":"isaacs","email":"i@izs.me","type":"user","roles":[],"date":"2013-12-25T20:42:32.599Z","fullname":"Isaac Z. Schlueter","fields":[{"name":"fullname","value":"Isaac Z. Schlueter","title":"Full Name","show":"Isaac Z. Schlueter"},{"name":"email","value":"isaacs@izs.me","title":"Email","show":"<a href=\"mailto:isaacs@izs.me\">isaacs@izs.me</a>"},{"name":"github","value":"isaacs","title":"Github","show":"<a rel=\"me\" href=\"https://github.com/isaacs\">isaacs</a>"},{"name":"twitter","value":"izs","title":"Twitter","show":"<a rel=\"me\" href=\"https://twitter.com/izs\">@izs</a>"},{"name":"appdotnet","value":"isaacs","title":"App.net","show":"<a rel=\"me\" href=\"https://alpha.app.net/isaacs\">isaacs</a>"},{"name":"homepage","value":"http://blog.izs.me","title":"Homepage","show":"<a rel=\"me\" href=\"http://blog.izs.me/\">http://blog.
View codecademy-max.js
var array = [-3 , -6, -2, -56, -32, -5, -89, -32];
function max1(array) {
var largest = array[0]; // start with the first item
for (i = 1; i < array.length; i++) // changed i to start at 1, to avoid extra work
if (array[i] > largest) {
largest = array[i];
}
return largest;
View gist:2884778
function Get-Hash {
[CmdletBinding(DefaultParameterSetName='file:sha1')]
param(
[Parameter(ParameterSetName='file:md5')]
[Parameter(ParameterSetName='string:md5')]
[Switch]
$MD5,
[Parameter(ParameterSetName='file:sha1')]
[Parameter(ParameterSetName='string:sha1')]
[Switch]
View gist:2360734
function Find-File {
[CmdletBinding(DefaultParameterSetName = 'Count')]
param(
[Parameter(Mandatory = $true, Position = 0)]
[string]$Name,
[Parameter(Position = 1)]
[string]$Directory = '.',
[Parameter(ParameterSetName = 'Count')]
[int]$MaxResults = 1,
[Parameter(ParameterSetName = 'All')]
View clipboard.psm1
Add-Type -Namespace PowershellPlatformInterop -Name Clipboard -MemberDefinition @"
[DllImport("user32.dll", SetLastError=true)]
public static extern bool EmptyClipboard();
[DllImport("user32.dll", SetLastError=true)]
public static extern IntPtr SetClipboardData(uint uFormat, IntPtr hMem);
[DllImport("user32.dll", SetLastError=true)]
public static extern IntPtr GetClipboardData(uint uFormat);
View gist:2019464
View gist:1238996
void Main()
{
Test(PerformIfBlocks).Dump("If blocks");
Test(PerformLogicalAnd).Dump("Logical AND");
Test(PerformLogicalOr).Dump("Logical OR");
}
private int Test(Func<int, int, bool> test) {
var cancel = false;
var task = Task.Factory.StartNew(() => {
View gist:1195440
let rec processMethodCalls (rule : IRule) (processor : MethodCall -> Option<Problem>) (mbr : Member) : ProblemCollection =
let problems = new ProblemCollection(rule)
let rec processMbrs mbrs = Seq.iter processMbr mbrs
and processMbr (mbr : Member) =
let rec processStmts stmts = Seq.iter processStmt stmts
and processStmt (stmt : Statement) =
let rec processExprs exprs = Seq.iter processExpr exprs
and processExpr (expr : Expression) =
match expr with
View gist:1182831
var target = new Border{ Background = Brushes.SteelBlue, Width = 200, Height = 200 };
var win = new Window{ Content = target };
var mouseDown = Observable.FromEventPattern<MouseEventArgs>(target, "MouseLeftButtonDown");
var mouseMove = Observable.FromEventPattern<MouseEventArgs>(target, "MouseMove");
var mouseUp = Observable.FromEventPattern<MouseEventArgs>(target, "MouseLeftButtonUp");
// dragEvents is IObservable<IObservable<EventPattern<MouseMoveEvent>>>
// The first dimmension represents the sequence of discrete drag "sessions"
// The second dimmension represents the sequence of moves within that drag