Skip to content

Instantly share code, notes, and snippets.

View cjlittle's full-sized avatar

cj little cjlittle

View GitHub Profile
@cjlittle
cjlittle / 0_reuse_code.js
Last active August 29, 2015 14:12
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
/* -*-javascript*-*
* Rename folder from Metadata (Rename mask)
*/
function ifnotempty(value, sep) {
return value.length > 0 ? value + sep : '';
}
function ifnotempty2(value1, value2, sep) {
return value1.length > 0 ? value1 + sep : value2.length > 0 ? value2 + sep : '';
/* -*-javascript -*-
* Rename folder from Metadata (Compilation rename mask)
*/
function ifnotempty(value, sep) {
return value.length > 0 ? value + sep : '';
}
function ifnotempty2(value1, value2, sep) {
return value1.length > 0 ? value1 + sep : value2.length > 0 ? value2 + sep : '';
/* -*-javascript-*-
Rename file from Metadata (Rename mask)
*/
function pad(number, length) {
if (number == '') { return ''; }
var str = '' + number;
while (str.length < length) {
str = '0' + str;
/* -*-javascript-*-
* Rename file from Metadata (Compilation rename mask)
*/
function pad(number, length) {
if (number == '') { return ''; }
var str = '' + number;
while (str.length < length) {
str = '0' + str;
}
return str;
// -*-javascript-*-
function ifnotempty(value, sep){
return value.length > 0 ? value + sep : '';
}
function ifnotempty2(value1, value2, sep){
return value1.length > 0 ? value1 + sep :value2.length > 0 ? value2 + sep:'' ;
}