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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
// Licensed under the MIT license with <3 by GitHub | |
/// <summary> | |
/// An exponential back off strategy which starts with 1 second and then 4, 9, 16... | |
/// </summary> | |
[SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] | |
public static readonly Func<int, TimeSpan> ExponentialBackoff = n => TimeSpan.FromSeconds(Math.Pow(n, 2)); | |
/// <summary> | |
/// Returns a cold observable which retries (re-subscribes to) the source observable on error up to the |
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 List | |
Private m_Items() | |
Private Sub Class_Initialize() | |
Redim m_Items(0) | |
End Sub | |
Property Get Count | |
Count = UBound(m_Items) - LBound(m_Items) |
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 T TryParse<T>(this string stringToParse) { | |
if (typeof(T).HasMethod("TryParse")) { | |
var m = typeof(T).GetMethod("TryParse", new Type[] { typeof(string), typeof(T).MakeByRefType() }); | |
T outParam = Activator.CreateInstance<T>(); | |
object[] ps = new object[] { stringToParse, outParam }; | |
bool result = (bool)m.Invoke(null, ps); | |
if (result) | |
return (T)ps[1]; | |
} | |
return default(T); |
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.Collections.Generic; | |
public class TransformedResult | |
{ | |
public IDataSource dataSource; | |
public TransformError errorList; | |
public bool HasErrors { | |
get { return errorList.HasErrors(); } |
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
{ | |
"logon": "[email protected]", | |
"addresses": [ | |
{ | |
"shippingAddressCount":"2", | |
"shipping": [ | |
{ | |
"firstName": "John", | |
"lastName": "Smith", | |
"address1": "111 Fake St.", |