Skip to content

Instantly share code, notes, and snippets.

Avatar

Clément Nerma ClementNerma

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am clementnerma on github.
  • I am clementnerma (https://keybase.io/clementnerma) on keybase.
  • I have a public key ASAMWy7709VbEi2h5KnYVjOkhNbulZpBzRLDzIefGi9DGQo

To claim this, I am signing this object:

View clone.js
/**
* Clone an object, contains fixes for the Radu Simionescu's clone function
* http://stackoverflow.com/questions/728360/most-elegant-way-to-clone-a-javascript-object?page=2&tab=active#tab-top
* @param {*} oReferance
* @return {*}
*/
var clone = function(oReferance) {
var aReferances = new Array();
var getPrototypeOf = function(oObject) {
if(typeof(Object.getPrototypeOf)!=="undefined")
@ClementNerma
ClementNerma / unit-test.js
Created Dec 21, 2015
A micro-library to perform basics unit tests without installing a complete library
View unit-test.js
var UnitTest = (new (function() {
var testOutput;
this.load = function(name) {
var req, testI, _test = true;
req = new XMLHttpRequest();
req.open('GET', name, false);
req.send(null);
@ClementNerma
ClementNerma / prototype.js
Created Dec 21, 2015
A lot of functions to extend possibilities of your scripts when manipulating some variables !
View prototype.js
Date.sleep = function(miliseconds) {
var e = new Date().getTime() + miliseconds;
while (new Date().getTime() <= e) {
;
}
};
Object.fullFreeze = function(obj) {
@ClementNerma
ClementNerma / console.js
Last active Dec 21, 2015
A micro-library to debug your code without opening the inspector
View console.js
'use strict';
var Console = function(parent) {
var DOM = document.createElement('div');
DOM.setAttribute('class', 'console');
DOM.setAttribute('style', 'border:1px solid gray;max-height:200px;overflow:auto;');
(parent || document.body).appendChild(DOM);
// Here are the logs
this.logs = {};
You can’t perform that action at this time.