Skip to content

Instantly share code, notes, and snippets.

View mauricesvay's full-sized avatar
💭
🍗

Maurice Svay mauricesvay

💭
🍗
View GitHub Profile
#!/bin/bash
# update hooks; note that this hook will still execute its current version and not
# the updated one
#git pull --rebase &>/dev/null
branch_name=$( git rev-parse --abbrev-ref HEAD )
is_special_branch=$( echo "${branch_name}" | grep -i "^\(hotfix\|develop\|master\|HEAD\)" )
if [ ! "${is_special_branch}" ]
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA7XwkkW4nDqT1r668SFgTfadtOuIafNhe7dTRllM76rIfsjEc07nQovQLTU9t24whQr3HS0sEzPJ6Sz+F1SbjtfTCuliNNinmcizswDJbXcwr6Pe6kDeb+ulB2tnmQ76janpWDpxYFZdYxqFqggHSc+Un+ubenlENTUOB+sy7PVRn54lfe0Pjlk5HsmCLNNA81VV6O82/77XYTR+7VYMPEmj8J4GYmpYiuNG5bM7aUnXPxJ73fG0eQXtCsZ9fGCah9eaxubfTQ8UvO+t+2aKc0a0+unaFEvEndo/17uGIhVdZhIQzop9ygsi/hGQDp8IDLgxDGPhYuO/N8ozjWrPOYw== mauricesvay@Macbook-Pro-de-Maurice.local
@mauricesvay
mauricesvay / gist:736880
Created December 10, 2010 21:53
Abusing localStorage to build an aggressive cache
var assets = [
'http://localhost/offline-assets/fancybox/jquery.fancybox-1.3.4.js',
'http://localhost/offline-assets/fancybox/jquery.fancybox-1.3.4.css'
];
for (var i=0,l=assets.length; i<l; i++) {
loadAsset(assets[i]);
}
function loadAsset(url){
@mauricesvay
mauricesvay / gist:1298340
Created October 19, 2011 13:54
.bash_profile
source "$HOME/.git-completion.bash" &&
export GIT_PS1_SHOWDIRTYSTATE=1 GIT_PS1_SHOWSTASHSTATE=1 GIT_PS1_SHOWUNTRACKEDFILES=1 &&
export PS1='\e[35m\u@\h:\e[36m\W\e[0m\e[33m$(__git_ps1 " (%s)")\e[0m\$'
//How to read RFID tags with a mir:ror and nodejs
//Requires https://github.com/hanshuebner/node-hid
var HID = require('HID');
var devices = new HID.devices(7592, 4865);
var hid;
if (!devices.length) {
console.log("No mir:ror found");
} else {
hid = new HID.HID(devices[0].path);
<div>
<pre>
....Les whitespace (matérialisés par les points), sont significatifs et apparaissent dans le rendu.
....</pre>
</div>
-----------------------------
En display : inline ou inline-block, les whitespace entre les <li> a un impact sur le rendu.
Du coup, il est courant de supprimer ces espaces en particulier.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<h1>Hello world</h1>
</body>
</html>
@mauricesvay
mauricesvay / prettyprint.js
Created September 10, 2012 16:26 — forked from knowtheory/prettyprint.js
A pretty printer for Javascript objects that looks like Ruby's pp formatter. In use on Rhino, untested elsewhere.
function pp(object, depth, embedded) {
typeof(depth) == "number" || (depth = 0)
typeof(embedded) == "boolean" || (embedded = false)
var newline = false
var spacer = function(depth) { var spaces = ""; for (var i=0;i<depth;i++) { spaces += " "}; return spaces }
var pretty = ""
if ( typeof(object) == "undefined" ) { pretty += "undefined" }
else if ( typeof(object) == "boolean" ||
typeof(object) == "number" ) { pretty += object.toString() }
else if ( typeof(object) == "string" ) { pretty += "\"" + object + "\"" }
@mauricesvay
mauricesvay / dump.js
Created November 1, 2012 14:52
Plugin for hoxy proxy that dumps responses to disk
/**
* Plugin for hoxy proxy that dumps responses to disk
* https://github.com/greim/hoxy
*
* Saves to disk (almost) everything that goes to your browser (images, videos, etc.)
* Simply add to rules.txt:
* response:@dump()
*/
var fs = require('fs');
@mauricesvay
mauricesvay / betasub.js
Last active December 12, 2015 02:09
Automatically unzip compressed subtitles
var exec = require('child_process').exec;
var http = require("http");
var fs = require('fs');
var APIKEY = 'c8c4da831d5c';
function showScrape(filename, callback) {
var url = "http://api.betaseries.com/shows/scraper.json?key=" + APIKEY + "&file=";
url = url + encodeURIComponent(filename);
http.get(url, function(res) {