Skip to content

Instantly share code, notes, and snippets.

⌛️
I may be slow to respond.

Atif Aziz atifaziz

⌛️
I may be slow to respond.
Block or report user

Report or block atifaziz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@atifaziz
atifaziz / 0_reuse_code.js
Created Mar 8, 2017
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View RetryWithBackOffStrategy.cs
// 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
View 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)
@atifaziz
atifaziz / GenericTryParse.cs
Created May 10, 2011 — forked from skoon/GenericTryParse.cs
First crack at trying a generic TryParse method.
View GenericTryParse.cs
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);
View gist:102643
using System.Collections.Generic;
public class TransformedResult
{
public IDataSource dataSource;
public TransformError errorList;
public bool HasErrors {
get { return errorList.HasErrors(); }
View json.txt
{
"logon": "john@fakesite.com",
"addresses": [
{
"shippingAddressCount":"2",
"shipping": [
{
"firstName": "John",
"lastName": "Smith",
"address1": "111 Fake St.",
You can’t perform that action at this time.