Skip to content

Instantly share code, notes, and snippets.

View wahidshalaly's full-sized avatar

Wahid Shalaly wahidshalaly

View GitHub Profile
git config --global alias.co checkout
git config --global alias.up 'pull --rebase --prune'
git config --global alias.history 'log --oneline --graph'
@wahidshalaly
wahidshalaly / vimrc
Last active February 22, 2021 00:41
syntax on
filetype plugin indent on
:set shiftwidth=2 tabstop=2
:set autoindent expandtab
:set ruler
:set hlsearch
# Gitin & Gitout Workarounds
$activeRepo = ".git"
$inactiveRepo = "project.git"
Function Rename-GitRepositoryToStart
{
$curPath = Join-Path $(Get-Location) $inactiveRepo
$newPath = Join-Path $(Get-Location) $activeRepo
bracketstestdrive@0.0.0 C:\temp\brackets-testdrive
+-- grunt@0.4.2
¦ +-- async@0.1.22
¦ +-- coffee-script@1.3.3
¦ +-- colors@0.6.2
¦ +-- dateformat@1.0.2-1.2.3
¦ +-- eventemitter2@0.4.13
¦ +-- exit@0.1.2
¦ +-- findup-sync@0.1.2
¦ ¦ +-- lodash@1.0.1
@wahidshalaly
wahidshalaly / XmlCustomSerializer
Created February 26, 2013 06:26
Simply, XML Custom Serialization.
public interface IXmlCustomSerializer
{
string Serialize<T>(T input);
T Deserialize<T>(string input);
}
public class XmlCustomSerializer : IXmlCustomSerializer
{
private XmlSerializer _serializer;
@wahidshalaly
wahidshalaly / QuotedPrinciples.txt
Last active October 7, 2015 19:28
My favourite quotes & principles. Things that I feel it represents me (or me-to-be)
Achievement
- Unless you try to do something beyond what you have already mastered, you will never grow.
Belief
- If you do not believe in yourself, Chances are that no body will either.
Character
- We must adjust to an ever changing road while holding onto our unchanging principles.
Courage
@wahidshalaly
wahidshalaly / ReadOnlyPropertiesIssue.cs
Created October 19, 2011 15:31
First, I thought, unluckily, I hit a bug on Json.NET while serializing enum but after testing the issue I found out that it seems something by design but I could not find it documented. So, here you are, tests I wrote to study the issue.
//#define UsingStringEnumConverter
using System;
#if UsingStringEnumConverter
using Newtonsoft.Json.Converters;
#endif
using NUnit.Framework;
namespace Newtonsoft.Json.Tests.Converters
{
@wahidshalaly
wahidshalaly / gist:1289852
Created October 15, 2011 17:10
Tax Calculation Challenge in CoffeeScript
#---BEGIN---
class TaxSlice
#---BEGIN---
constructor: (min, max, rate) ->
if min is null
throw new Error "null value is not acceptable for min"
if min >= max and max is not null
throw new Error "min cannot be greater than or equal max"
@wahidshalaly
wahidshalaly / NinjectExampleForConstructorArgument.cs
Created July 3, 2010 08:05
Example of NInject usage for a class with a parameterized constructor
using System;
using Ninject;
using Ninject.Parameters;
using NUnit.Framework;
namespace NinjectExample
{
[TestFixture]
public class NinjectTests
{
private Account _account;
private decimal _openingBalance = 2500m;
private decimal _positiveAmount = 1000m;
private void Given_account_with_positive_balance()
{
string name = "Account Name";
string description = "Account Description";
_account = new Account(name, description, _openingBalance);