Skip to content

Instantly share code, notes, and snippets.

View hahmed's full-sized avatar

Haroon Ahmed hahmed

View GitHub Profile
@hahmed
hahmed / Gemfile
Created June 26, 2020 07:40 — forked from dhh/Gemfile
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
using (var repo = new Repository("path\to\repo.git"))
{
// Object lookup
var obj = repo.Lookup("sha");
var commit = repo.Lookup<Commit>("sha");
var tree = repo.Lookup<Tree>("sha");
var tag = repo.Lookup<Tag>("sha");
// Rev walking
foreach (var c in repo.Commits.Walk("sha")) { }
/*
You can now create a spinner using any of the variants below:
$("#el").spin(); // Produces default Spinner using the text color of #el.
$("#el").spin("small"); // Produces a 'small' Spinner using the text color of #el.
$("#el").spin("large", "white"); // Produces a 'large' Spinner in white (or any valid CSS color).
$("#el").spin({ ... }); // Produces a Spinner using your custom settings.
$("#el").spin(false); // Kills the spinner.
@hahmed
hahmed / tax.cs
Created September 22, 2011 12:02 — forked from flq/tax.cs
the tax thingy
public decimal GetTaxes(decimal salary)
{
decimal tax = 0;
var progressiveTaxation = new[] { 0.1m, 0.14m, 0.23m, 0.3m, 0.33m, 0.45m };
var progressionSlices = new[] { 5070 - 0, 8660 - 5070, 14070 - 8660, 21240 - 14070, 40230 - 21240, decimal.MaxValue };
var progression = 0;
while (salary > 0)
@hahmed
hahmed / UoW.cs
Created July 31, 2011 07:20 — forked from tobinharris/UoW.cs
using System;
using System.Collections.Generic;
using System.IO;
using FluentNHibernate;
using FluentNHibernate.AutoMap;
using FluentNHibernate.Cfg.Db;
using NHibernate;
using NHibernate.Cfg;
using NHibernate.Context;
using NHibernate.Event;
@hahmed
hahmed / msbuilder.py
Created July 19, 2011 19:10 — forked from rcravens/msbuilder.py
Python Script to Automate MSBuild Tasks
import os, shlex, subprocess, re, datetime
class MsBuilder:
def __init__(self, msbuild=None, mstest=None, nuget=None, trx2html=None):
# The following dictionary holds the location of the various
# msbuild.exe paths for the .net framework versions
if msbuild==None:
self.msbuild = r'C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe'
else:
self.msbuild = msbuild
@hahmed
hahmed / gist:1039919
Created June 22, 2011 11:35 — forked from ArnisL/gist:634186
userSession.cs
public class UserSession:IUserSession{
private readonly IAuthenticationService _authenticationService;
private readonly ICryptographer _crypto;
private readonly IUserRepository _repository;
public UserSession(IUserRepository repository,IAuthenticationService authenticationService,ICryptographer crypto){
Guard.AgainstNull(repository);
Guard.AgainstNull(authenticationService);
Guard.AgainstNull(crypto);
_repository=repository;
_crypto=crypto;