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
# Git functions | |
# Mark Embling (http://www.markembling.info/) | |
# Is the current directory a git repository/working copy? | |
function isCurrentDirectoryGitRepository { | |
if ((Test-Path ".git") -eq $TRUE) { | |
return $TRUE | |
} | |
# Test within parent dirs |
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
Get-ChildItem $psScriptRoot -filter *.ps1 | foreach { . $_.FullName } | |
if(Get-Module prompt) { Remove-Module prompt } | |
$prompt_kind = if($args[0]) { $args[0] } else { "bash" } | |
if($prompt_kind -eq "bash") { | |
function prompt { | |
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
public static class NotifyPropertyChangedExtensions | |
{ | |
public static IObservable<TProp> GetPropertyChanges<TSource, TProp>(this TSource source, Expression<Func<TSource, TProp>> propertySelector, bool lightCompile = true) | |
where TSource : INotifyPropertyChanged | |
{ | |
var propertyName = GetPropertyName(propertySelector); | |
return Observable | |
.FromEvent<PropertyChangedEventHandler, PropertyChangedEventArgs>( | |
h => new PropertyChangedEventHandler((s, e) => h(e)), |
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
********************** | |
Windows PowerShell Transcript Start | |
Start time: 20110523192949 | |
Username : NORTHHORIZON\daniel | |
Machine : POLARIS (Microsoft Windows NT 6.1.7601 Service Pack 1) | |
********************** | |
Transcript started, output file is C:\Users\daniel\Documents\PowerShell_transcript.20110523192949.txt | |
PS C:\Users\daniel> | |
2 > Import-Module powershellpack | |
PS C:\Users\daniel> |
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
param([string] $CountProperty = 'Count', | |
[string] $NameProperty = 'Name', | |
[double] $Width = 400, | |
[double] $Height = 300, | |
[string] $WindowTitle = 'Pie Graph', | |
[string] $ChartTitle = $null, | |
[Parameter(ValueFromPipeline = $true)] $Items, | |
[switch] $Show = $false) | |
begin { | |
Import-Module wpk |
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
// doesn't detect Never() | |
public static IObservable<bool> IsAlive_Merge<T>(this IObservable<T> source, TimeSpan timeout, IScheduler sched) | |
{ | |
return source.Select(_ => true) | |
.Merge(source.Select(_ => false).Throttle(timeout, sched)) | |
.DistinctUntilChanged(); | |
} | |
// D.Moore, 29 May: using the buffer count should cause this to fire as soon as it's available. | |
public static IObservable<bool> IsAlive_Buffer<T>(this IObservable<T> source, TimeSpan timeout, IScheduler sched) |
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
Console.ReadLine(); | |
var sched = Scheduler.TaskPool; | |
var count = Observable | |
.Return(new Unit(), sched) | |
.Repeat() | |
// Use NewThread to avoid bias on the cutoff. | |
.TakeUntil(Observable.Timer(TimeSpan.FromSeconds(5), Scheduler.NewThread)) | |
.Count() |
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
private bool IsIncluded(LazyMemberInfo memberInfo) | |
{ | |
var accessors = memberInfo.GetAccessors().Where(a => a != null); | |
var types = accessors.Select(m => m as Type ?? m.DeclaringType); | |
var assemblies = types.Select(t => t.Assembly).Distinct().Where(a => a != null); | |
var scopeSets = new[] | |
{ | |
// Local Scopes |
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 Get-MeetupRsvps([string]$eventId, [string]$apiKey) { | |
$nameWord = "[\w-']{2,}" | |
$regex = "^(?'first'$nameWord) ((\w\.?|($nameWord )+) )?(?'last'$nameWord)|(?'last'$nameWord), ?(?'first'$nameWord)( \w\.|( $nameWord)+)?$" | |
function Get-AttendeeInfo { | |
process { | |
$matches = $null | |
$answer = $_.answers.answers_item | |
if(-not ($_.name -match $regex)) { $answer -match $regex | Out-Null } |
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 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 |
OlderNewer