Skip to content

Instantly share code, notes, and snippets.

View ClementNerma's full-sized avatar

Clément Nerma ClementNerma

  • France
View GitHub Profile

ZSH CheatSheet

This is a cheat sheet for how to perform various actions to ZSH, which can be tricky to find on the web as the syntax is not intuitive and it is generally not very well-documented.

Strings

Description Syntax
Get the length of a string ${#VARNAME}
Get a single character ${VARNAME[index]}

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:

/**
* 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 December 21, 2015 18:12
A micro-library to perform basics unit tests without installing a complete library
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 December 21, 2015 17:56
A lot of functions to extend possibilities of your scripts when manipulating some variables !
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 December 21, 2015 17:51
A micro-library to debug your code without opening the inspector
'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 = {};