Skip to content

Instantly share code, notes, and snippets.

View mauricesvay's full-sized avatar
💭
🍗

Maurice Svay mauricesvay

💭
🍗
View GitHub Profile
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA7XwkkW4nDqT1r668SFgTfadtOuIafNhe7dTRllM76rIfsjEc07nQovQLTU9t24whQr3HS0sEzPJ6Sz+F1SbjtfTCuliNNinmcizswDJbXcwr6Pe6kDeb+ulB2tnmQ76janpWDpxYFZdYxqFqggHSc+Un+ubenlENTUOB+sy7PVRn54lfe0Pjlk5HsmCLNNA81VV6O82/77XYTR+7VYMPEmj8J4GYmpYiuNG5bM7aUnXPxJ73fG0eQXtCsZ9fGCah9eaxubfTQ8UvO+t+2aKc0a0+unaFEvEndo/17uGIhVdZhIQzop9ygsi/hGQDp8IDLgxDGPhYuO/N8ozjWrPOYw== [email protected]
@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 / webmail.js
Created October 19, 2012 20:13
Controlling cheap USB LED notifiers with nodejs and node-hid
/* Controlling cheap USB LED notifiers with node-hid */
var Notifier = function(hid) {
this.hid = hid;
this.colors = ['OFF', 'BLUE', 'RED', 'GREEN', 'CYAN', 'PURPLE', 'YELLOW', 'WHITE'];
};
Notifier.prototype.write = function(arBytes) {
this.hid.write(arBytes);
};
Notifier.prototype.color = function(value) {
@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 / gist:4408150
Created December 29, 2012 17:19
Parse iwlist scan output in JavaScript (nodejs)
function iwlistParse(str) {
var out = str.replace(/^\s+/mg, '');
out = out.split('\n');
var cells = [];
var line;
var info = {};
var fields = {
'mac' : /^Cell \d+ - Address: (.*)/,
'ssid' : /^ESSID:"(.*)"/,
'protocol' : /^Protocol:(.*)/,