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
using System; | |
using System.Collections.Generic; | |
using System.Text; | |
using System.IO; | |
using System.Security.Cryptography; | |
using System.Diagnostics; | |
namespace DuplicateFileFinder | |
{ |
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
sealed class StringBuilderEx | |
{ | |
readonly List<Func<string>> parts; | |
Func<string, string> replace = null; | |
public int Capacity | |
{ | |
get | |
{ |
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
abstract class ListPair<T> | |
where T : IComparable<T> | |
{ | |
static IEnumerable<T> empty = new T[0]; | |
public abstract IEnumerable<T> Merge(); | |
protected virtual LeftList Left { get; private set; } | |
protected virtual RightList Right { get; private set; } |
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 $xhr(url, success, fail) { | |
var _url = url; | |
var me = this; | |
var seperator = 'sdfsdfsdfdsweriweournClkjwa'; //TODO: Replace with a real pseudo random string generator | |
me.data = {}; | |
function request_success(x) { | |
return (x.status == 200) || (x.status == 304); | |
} |
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
window.addHandler = window.addEventListener || window.attachEvent; | |
window.removeHandler = window.removeEventListener || window.detachEvent; | |
Object.prototype.isArray = function () | |
{ | |
return this.hasOwnProperty('length') && this.pop != null && this.push != null && this.join != null; | |
} | |
var Random = new (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
var DAYS = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; | |
function is_leap_year(y) | |
{ | |
if((y % 4) != 0) | |
return false; | |
if((y % 100) == 0 && ((y % 400) != 0)) | |
return false; |
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
static IEnumerable<T> QuickSort<T>(IList<T> xs) | |
where T : IComparable<T>, IEquatable<T> | |
{ | |
var stack = new Stack<Stack<T>>(new[] {new Stack<T>(xs)}); | |
while (stack.Any()) | |
{ | |
var qs = stack.Pop(); | |
var head = from q in qs where q.CompareTo(qs.Peek()) == 0 select q; |
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
class SubstringRecognition | |
{ | |
readonly string s; | |
int state = 0; | |
int pos = 0; | |
Func<char, SubstringRecognition>[] accept; | |
public bool Found | |
{ |
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
void Main() | |
{ | |
try | |
{ | |
SomeUnreliableOperation(); | |
} | |
catch (SomeUnreliableOperationException.NotFound ex) | |
{ | |
//do stuff | |
} |
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
type Foo = | |
| Bar of int * string | |
| Baz of bool * string | |
| Biz of string * string | |
let f foo = | |
match foo with | |
| Bar (x, s) -> s | |
| Baz (b, s) -> s |
OlderNewer