Skip to content

Instantly share code, notes, and snippets.

View jonathascosta's full-sized avatar

Jonathas Costa jonathascosta

  • Porto, Portugal
View GitHub Profile
anonymous
anonymous / DateExtensions.js
Created September 5, 2016 20:25
Date Extensions for Javascript
Date.prototype.clone = function () {
return new Date(this.valueOf());
}
Date.prototype.addDays = function (days) {
var d = this.clone();
d.setDate(d.getDate() + days);
return d;
}
@alexeds
alexeds / move-stashes.md
Created September 5, 2012 18:00
Move your stashes from one repo to another

Move your stashes from one repo to another


This was useful for me when we created a new branch for a new major release, but were still working on our current version as well. I cloned our repo again and kept the new project on our new branch, but also wanted to get my stashes there.

Download your stashes

git stash show -p > patch

You'll have to specify your stash and name your file whatevery you want. Do this for as all your stashes, and you'll have patch files in your pwd.

@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@jonathascosta
jonathascosta / LocalizedModelBinder.cs
Created May 17, 2011 20:27
Localized Model Binder for specified culture
public class LocalizedModelBinder : DefaultModelBinder
{
private readonly CultureInfo _cultureInfo;
public LocalizedModelBinder(string cultureName)
{
_cultureInfo = CultureInfo.GetCultureInfo(cultureName);
}
public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)