Skip to content

Instantly share code, notes, and snippets.

View m4dz's full-sized avatar

m4dz m4dz

View GitHub Profile
@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 / README.md
Last active January 27, 2023 01:14
OS X Fresh (Re)Install

OS X ENV (re)Install

This is my personal guide to restore my configuration and setup my system for a fresh install. I use it and keep it updated frequently. Hope it will inspire you on your own way =].

Backup

Before a fresh reinstall, don't forget to backup many things. A regular ghost made with CarbonCopyCloner or Clonezilla is a good solution, but if you can't, you should save the following:

@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"
@m4dz
m4dz / README.md
Last active December 16, 2015 13:49
DOM events mouse style detection in <canvas/> with heatmaps - Generic lib implementation

Problem : you can't attach DOM style mouse events (over, out, click…) on elements drawn onto a element.

Solution : Heatmaps ! When drawing onto the <canvas/>, do the same onto a "hidden" map canvas that will NEVER be inserted into the DOM. Assign random colors to the elements drawn to the map, then add regular DOM events to the visible element. When an event fire up, compare coordinates of the mouse in the <canvas/>, to the map, detect the color to find the element on which the event apply, then fire the custom event stack.

So simple isn't it ? Hack you said ;) ?

Wait… It's just JavaScript !

# The configfile is divided into three parts;
# 1) serversettings
# 2) rules
# 3) routes
#
# The recommended order is:
# Serversettings:
# logoutput
# internal
# external
@m4dz
m4dz / README.md
Last active March 17, 2016 13:26
jQuery plugins boilerplates

This files contains my boilerplates for jQuery plugins.