Skip to content

Instantly share code, notes, and snippets.

View m4dz's full-sized avatar

m4dz m4dz

View GitHub Profile
@m4dz
m4dz / drupal-vhost.conf
Last active August 29, 2015 14:07
Nginx via Homebrew dotfiles
server {
listen 80;
server_name drupal-7.x.dev;
root /Users/mads/Sites/drupal-7.x.dev;
error_log /Users/mads/Sites/logs/drupal-7.x.dev-error.log;
# Drupal rules
#
@m4dz
m4dz / keybase.md
Last active August 29, 2015 14:14
keybase.md

Keybase proof

I hereby claim:

  • I am m4dz on github.
  • I am m4dz (https://keybase.io/m4dz) on keybase.
  • I have a public key whose fingerprint is 3359 9EB0 7403 4DB8 3942 5BEF D462 7C41 7D96 9710

To claim this, I am signing this object:

Les dingues et les paumés jouent avec leurs manies
Dans leurs chambres blindées leurs fleurs sont carnivores
Et quand leurs monstres crient trop près de la sortie
Ils accouchent des scorpions et pleurent des mandragores
Et leurs aéroports se transforment en bunkers
A quatre heures du matin derrière un téléphone
Quand leurs voix qui s'appellent se changent en revolvers
Et s'invitent à calter en se gueulant come on
Les dingues et les paumés se cherchent sous la pluie
FOUND_NDENV=0
ndenvdirs=("$HOME/.ndenv" "/usr/local/ndenv" "/opt/ndenv")
for ndenvdir in "${ndenvdirs[@]}" ; do
if [ -d $ndenvdir/bin -a $FOUND_NDENV -eq 0 ] ; then
FOUND_NDENV=1
export PATH=${ndenvdir}/bin:$PATH
eval "$(ndenv init --no-rehash - zsh)"
function ndenv_prompt_info() {
@m4dz
m4dz / check.svg
Created June 21, 2012 12:16
Use GET parameter "color" with an hex value to change the fill in an SVG file
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@m4dz
m4dz / getParams.js
Created June 21, 2012 16:53
Construct an object with the GET passing values
function getParams() {
var href,
paramList,
arg,
refs = {};
href = document.defaultView.location.href;
if ( -1 != href.indexOf("?") )
{
paramList = href.split("?")[1].split(/&|;/);
@m4dz
m4dz / gist:4017334
Created November 5, 2012 14:04
LessCSS Radial Gradient compliant mixin
.radial-gradient(@position, @cover, @begin, @end, ...) {
@props: ~`"@{arguments}".replace(/[\[\]]/g, '')`;
@stop_color: ~`"@{props}".split(/[\s,]+/).slice(-2, -1)`;
background-color: @stop_color;
background: -webkit-radial-gradient(@props);
background: -moz-radial-gradient(@props);
background: -ms-radial-gradient(@props);
background: -o-radial-gradient(@props);
background: radial-gradient(@props);
@m4dz
m4dz / gist:4065644
Created November 13, 2012 12:59
LessCSS transition compliant syntax
// CSS TRANSITIONS ------------------------------------------------------------/
// I pass 2 args to the method but the second one is only here to prevent
// LessCSS to this bloody trick that @arguments return an array if there's two
// args but a string when there's only one oO'…
.transition (@param, @fakeParam:X, ...)
{
// Explode arguments and remove the fakeParam
@args : ~`"@{arguments}".replace(/[\[\]]|\sX/g, '')`;
// Specify prefixable properties seperated with commas
// i.e.: ~"transform,opacity"
@m4dz
m4dz / gist:4204155
Created December 4, 2012 13:59
retina sprites
/* Compass HiDPI sprite helper
*
* Pre-requisites :
* - the hidpi sprite images needs to be in a folder near the standard one, and
* named **<name>_hidpi** (e.g. **images/icons** and **images/icons_hidpi**)
*
* @author : MAD <ecrire@madsgraphics.com>
*/
// ****************************************************************************/
@m4dz
m4dz / commiter.sh
Last active December 14, 2015 04:39
Git pre-commit message that auto-fill the message with the tracker issue reference. You can also use the commiter.sh script as git core.editor to edit your commit message : the carret will be placed at the EOL, waiting for the rest of the message :)
#!/bin/sh
ISSUE=$(git symbolic-ref HEAD 2> /dev/null | cut -b 14-)
COLS=$((${#ISSUE} + 10))
subl -n -w "$*:1:$COLS"