Skip to content

Instantly share code, notes, and snippets.

View xavierm02's full-sized avatar

MONTILLET Xavier xavierm02

View GitHub Profile
@xavierm02
xavierm02 / LICENSE.txt
Created June 17, 2011 15:42 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@xavierm02
xavierm02 / subgit
Created September 26, 2011 19:38 — forked from rustyio/subgit
subgit
#!/usr/bin/env sh
# subgit
#
# A tiny wrapper around git to help you manage
# Git sub-projects easily, safely, and simply.
#
# Created by Rusty Klophaus (@rklophaus)
#
# See http://rklophaus.com/subgit for usage.
@xavierm02
xavierm02 / gist:1313126
Created October 25, 2011 15:25
A way to "subclass" Array. It will fail if you add something at an index > the length of the array. Doesn't provide Array as [[Class]] either.
var FakeArray = ( function ( ) {
function FakeArray( ) {
var fakeArray = Object.create( FakeArray.prototype );
var realArray = Array.apply( Object.create( Array.prototype ), arguments );
Object.defineProperty( fakeArray, '', {
value: realArray
} );
forwardIndexesUntil( realArray.length );
return fakeArray;
}
@xavierm02
xavierm02 / jshint-hash-options.user.js
Created January 9, 2012 19:47
jshint-hash-options.user.js
// ==UserScript==
// @match http://www.jshint.com/
// ==/UserScript==
( function ( ) {
'use strict';
var slice = [ ].slice;
var checkboxesByIndex = slice.call( document.getElementsByClassName( 'options' ) ).map( function ( node ) {
return node.getElementsByTagName( 'input' );
} ).reduce( function ( nodeList1, nodeList2 ) {
@xavierm02
xavierm02 / _tags
Last active December 22, 2015 12:09
A possible implementation for a cartesian product function of the Enum module.
<*>: package(batteries)
@xavierm02
xavierm02 / Object.getPrototypeOf.js
Created June 13, 2011 14:39
Polyfill for Object.getPrototypeOf -- It will work unless your constructor's prototype doesn't have a constructor property (which means you assigned another object as prototype and didn't give it a constructor property...)
if ( typeof Object.getPrototypeOf !== "function" ) {
( function ( ) {
function getPrototypeValue( o, p ) {
if ( o.hasOwnProperty( p ) ) {
var ownValue = o[ p ];
if ( delete o[ p ] ) {
var prototypeValue = o[ p ];
o[ p ] = ownValue;
return prototypeValue;
} else {