Skip to content

Instantly share code, notes, and snippets.

View dominicmartineau's full-sized avatar

Dominic Martineau dominicmartineau

View GitHub Profile
@dominicmartineau
dominicmartineau / bands
Last active August 29, 2015 14:11 — forked from bchhun/bands
Indie folk bands
* Bon Iver
* City & Colour
* Dan Magan
* Donovan Woods
* Iron & wine
* Postdata
* Sufjan Stevens
* The Tallest Man On Earth
* Volcano Choir
@dominicmartineau
dominicmartineau / index.blade.php
Created June 29, 2014 14:08
A really simple homepage with a layout
@extends('layout')
@section('content')
<h1>Hello world!</h1>
@endsection
sudo npm install -g gulp
cd myproject
npm install --save-dev gulp
@dominicmartineau
dominicmartineau / gh-deploy
Last active August 29, 2015 14:02
Shell script to deploy a subtree (dist) to gh-pages branch
#!/bin/sh
git subtree push --prefix dist origin gh-pages
@dominicmartineau
dominicmartineau / gist:5957140
Last active December 19, 2015 12:48
Laravel 4: How to redirect to 404 page after exception thrown. Simply add a redirect to your 404 page at the end of 'App::error()' into app/start/global.php. You should return to your 404 page only if debug is not enabled.
App::error(function(Exception $exception, $code)
{
Log::error($exception);
if (Config::get('app.debug') == false) {
return Redirect::route('404');
}
});
@dominicmartineau
dominicmartineau / gist:5934521
Created July 5, 2013 13:28
To handle 404 in Laravel 4, put this code into app/start/global.php...
App::missing(function($exception)
{
return Redirect::route('404');
});
@dominicmartineau
dominicmartineau / gist:5604996
Created May 18, 2013 16:27
Twitter Bootstrap tooltip placement based on element's position
$('.element').tooltip({
placement: function(context, source) {
if ($(source).position().top < 100) {
return 'bottom';
} else {
return 'top';
}
}
});
@dominicmartineau
dominicmartineau / gist:5549504
Created May 9, 2013 18:31
Git equivalent to 'hg out'. Put this into '/usr/local/bin/git-out' and then run 'git out' into your project folder.
#!/bin/sh
CURRENTBRANCH=$(git branch | grep "*" | sed "s/* //")
echo "Outgoing commits for branch "$CURRENTBRANCH
git log origin/$CURRENTBRANCH..$CURRENTBRANCH --name-status
@dominicmartineau
dominicmartineau / gist:5489523
Created April 30, 2013 15:38
To avoid Recess to rewrite 'calc' expression...
.classname {
height: calc(100% - 50px); # Not Ok (will be rewrite as 'calc(50%)')
height: calc(~"100% - 50px"); # Ok!
}
@dominicmartineau
dominicmartineau / Minify all CSS
Created April 29, 2013 18:27
Minify all CSS files of a directory...
#! /bin/bash
for s in $(find path/to/css/ -iname *.css | grep -v "\.min.css")
do
FILEMIN=${s/.css/.min.css}
if [ -f $FILEMIN ]
then
rm $FILEMIN
fi
echo "Processing " $FILEMIN;