Skip to content

Instantly share code, notes, and snippets.

View daniellee's full-sized avatar

Daniel Lee daniellee

View GitHub Profile
@ToJans
ToJans / crowdsourced_abstract_tojans.md
Last active August 29, 2015 14:21
Crowdsourced abstract for @ToJans at buildstuff.lt this year

This is a crowd-sourced abstract

I want you

As I have no idea what to talk about at buildstuff this year, I want to give you the opportunity to decide:

  • Fork the gist.
  • Change the title/text into a proper abstract.
  • Mention it on twitter to me (@tojans)
@jbogard
jbogard / rebase.ps1
Created January 28, 2014 17:34
Auto rebase all the things
git config --global push.default tracking
git config --global branch.autosetuprebase always
git config --local branch.master.rebase true
@liammclennan
liammclennan / consumer.js
Created February 9, 2013 03:43
Node.js dependency injection
var declaration = require('./declaration');
declaration();
// --> assertion error 3 is not equal to 4
declaration({
assert: {
equal: function () {
return true;
}
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@ThatRendle
ThatRendle / vs.sh
Created June 20, 2012 14:49
Shell script to launch Visual Studio with either named sln or most recently modified
if [ -n "$1" ]; then
file=$1
else
file=( $(ls -xt *.sln | head -n1))
fi
if [ -z "$file" ]; then
echo "No solution found."
exit 1
fi
/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio\ 11.0/Common7/IDE/devenv.exe "$file" &
@liammclennan
liammclennan / a.md
Created May 30, 2012 02:33
Object-object Mapping - Why I don't use Automapper

Object-object Mapping - Why I don't use Automapper

At the boundaries of an application it is often nice to map objects from one form to another. The most common example is mapping domain entities to view models, or mapping to dtos for network transfer.

Automapper is a library for removing the duplication from object-object mapping code by mapping by convention. When the conventions don't map the way you want you can explicitly map properties.

After using AutoMapper on a couple of projects I have stopped using it. The problem is that the convention based mappings introduce annoying bugs when property names change or the object graph changes. When a change breaks the convention it results in a runtime exception. Very annoying.

What I Do Instead

@pamelafox
pamelafox / senderror.js
Created February 21, 2012 19:20
Sending JS errors to server
function sendError(message, url, lineNum) {
var i;
// First check the URL and line number of the error
url = url || window.location.href;
lineNum = lineNum || 'None';
// If the error is from these 3rd party script URLs, we ignore
// We could also just ignore errors from all scripts that aren't our own
var scriptURLs = [
@wallin
wallin / script.js
Created April 12, 2011 21:11 — forked from jacobk/script.js
$(function() {
$('div.content').live('showoff:show', function(evt) {
var bg_img = $('img[alt=background]', evt.target);
var old_bg = '';
if (bg_img.size() > 0) {
var src = bg_img.attr('src');
bg_img.hide();
// Set new background on body
old_bg = $('body').css('background-image');
$('body')