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
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| public interface Maybe<T> { } | |
| public class Nothing<T> : Maybe<T> { } | |
| public class Just<T> : Maybe<T> { | |
| public T Value { get; private set; } |
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
| # Committing changes to a repo via the Github API is not entirely trivial. | |
| # The five-step process is outlined here: | |
| # http://developer.github.com/v3/git/ | |
| # | |
| # Matt Swanson wrote a blog post translating the above steps into actual API calls: | |
| # http://swanson.github.com/blog/2011/07/23/digging-around-the-github-api-take-2.html | |
| # | |
| # I was not able to find sample code for actually doing this in Ruby, | |
| # either via the HTTP API or any of the gems that wrap the API. | |
| # So in the hopes it will help others, here is a simple function to |
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
| // This is a hacky sample (that works for me) of alternative way to use Lokad-codeDSL | |
| // or any similar way of generating message contracts on-the-fly. Original approach was | |
| // with using T4 template, that would rebuild cs files from DSL representation, whenever | |
| // we hit Ctrl-S. | |
| // This approach works almost exactly like this (Ctrl-S to rebuild), but does not require VS | |
| // to run or does not require unloading VS to change the underlying generator code. | |
| // in fact it is extremely boring. Lolcats from MightyMoose could be used to improve the situation, though. | |
| // any takers? :) |
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
| //Stupid "Schrodinger sort (cat not involved!)" based on http://dis.4chan.org/read/prog/1295544154 - great antipattern | |
| static void Main(string[] args) | |
| { | |
| int[] xs = new[] { 5, 3, 6, 3, 6, 3, 1, 4, 7}; | |
| var results = new ConcurrentQueue<int>(); | |
| Console.WriteLine("Sorted:"); | |
| Parallel.ForEach(xs, n => | |
| { | |
| Thread.SpinWait(n); //Thread.Sleep(n); |
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
| Properties { | |
| $Build_dir = Split-Path $psake.build_script_file | |
| $Packages_dir = Join-Path $build_dir 'Packages' | |
| $MsDeploy_dir = Join-Path $env:ProgramFiles 'IIS\Microsoft Web Deploy' | |
| $SiteName = 'www.example.com' | |
| $Package = "$SiteName.zip" | |
| $Dest = 'hosting.com' | |
| $UserName = 'IIS User Name' | |
| $Pwd = 'Secret Password' |
NewerOlder