Skip to content

Instantly share code, notes, and snippets.

{
"logon": "[email protected]",
"addresses": [
{
"shippingAddressCount":"2",
"shipping": [
{
"firstName": "John",
"lastName": "Smith",
"address1": "111 Fake St.",
using System.Collections.Generic;
public class TransformedResult
{
public IDataSource dataSource;
public TransformError errorList;
public bool HasErrors {
get { return errorList.HasErrors(); }
@atifaziz
atifaziz / GenericTryParse.cs
Created May 10, 2011 06:52 — forked from skoon/GenericTryParse.cs
First crack at trying a generic TryParse method.
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);
@atifaziz
atifaziz / List.vbs
Last active December 16, 2015 06:09 — forked from anonymous/List.vbs
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)
// 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
@atifaziz
atifaziz / 0_reuse_code.js
Created March 8, 2017 08:14
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console