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
| let GetChainLength value = | |
| let next x = match x % 2L with | |
| | 0L -> x / 2L | |
| | _ -> x * 3L + 1L | |
| let rec chain n acc = match n with | |
| | x when x <= 1L -> acc | |
| | x -> chain (next x) (acc+1) | |
| value, (chain value 1) | |
| seq { 1L..999999L } |
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
| static void Main(string[] args) | |
| { | |
| var f = Fault(() => Console.WriteLine("Okay"), | |
| () => Console.WriteLine("Fault")); | |
| f(); | |
| Console.WriteLine(); | |
| var g = Fault(() => { throw new Exception("Oops"); }, | |
| () => Console.WriteLine("Fault")); | |
| try |
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
| Index: branches/1.3.1/src/Core/IE.cs | |
| =================================================================== | |
| --- branches/1.3.1/src/Core/IE.cs (revision 1091) | |
| +++ branches/1.3.1/src/Core/IE.cs (working copy) | |
| @@ -20,6 +20,7 @@ | |
| using System.Collections; | |
| using System.Diagnostics; | |
| using System.Drawing; | |
| +using System.Net; | |
| using System.Runtime.InteropServices; |
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
| alias.lg=log -w -C --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative | |
| alias.dd=diff -w -C --diff-filter=ACMRTUXB | |
| alias.fp=format-patch -w -C --diff-filter=ACMRTUXB -o c:/Dev/JP/Patches | |
| alias.new=log -w -C --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative origin/master.. | |
| alias.up=!git svn rebase && git push . remotes/git-svn:master && git push origin master | |
| alias.dci=!git svn dcommit && git push . remotes/git-svn:master && git push origin master |
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
| filter disableSigning() { | |
| $proj = $_ | |
| $xml = [xml](Get-Content $proj.FullName) | |
| $propertyGroup = $xml.Project.PropertyGroup | ? {$_.SignAssembly} | |
| if($propertyGroup.SignAssembly -eq 'true') { | |
| echo "Disabling Signing: $proj" | |
| $propertyGroup.SignAssembly = 'false' | |
| $xml.save($proj.FullName) | |
| Push-Location $proj.DirectoryName |
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 NestedSetModelTest | |
| { | |
| public class Node | |
| { | |
| public Node(string value, params Node[] children) | |
| { | |
| Value = value; | |
| Children = children; | |
| } |
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 Write-ChildGitStatus($dir = '.') | |
| { | |
| gci $dir | | |
| where { $_.PSIsContainer } | | |
| foreach { | |
| pushd $_ | |
| $s = Get-GitStatus | |
| if($s) { | |
| Write-Host -NoNewline $_.Name | |
| Write-GitStatus $s |
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
| *.cs diff=csharp |
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
| static IObservable<string> CheckForFraud(IObservable<string> logins) | |
| { | |
| return from g in logins.GroupByUntil(l => l, CheckForFraud) | |
| from c in g.Count() | |
| where c >= 3 | |
| select g.Key; | |
| } | |
| static IObservable<Unit> CheckForFraud(IGroupedObservable<string, string> g) | |
| { |
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
| $svcName = Get-Service -DisplayName *cruise* | select -Exp Name | |
| $svcKey = Get-Item HKLM:\SYSTEM\CurrentControlSet\Services\$svcName | |
| # Set 9th bit, from http://www.codeproject.com/KB/install/cswindowsservicedesktop.aspx | |
| $newType = $svcKey.GetValue('Type') -bor 0x100 | |
| Set-ItemProperty $svcKey.PSPath -Name Type -Value $newType |
OlderNewer