Skip to content

Instantly share code, notes, and snippets.

View tracend's full-sized avatar
🎯
Focusing

✌ Makis Tracend tracend

🎯
Focusing
View GitHub Profile
@tracend
tracend / build.js
Last active August 29, 2015 14:07
Build script using Node.js
// # Build script using Node.js
//
// Single script build,used as a lightweight alternative
// when a build platform (grunt/gulp wtc.) feels like overkill
//
// - Dependencies: NPM/Node.js
// - Conventions:
// * code is in a lib/ folder with a main.js as the main context (closure)
// * a package.json on the root contains all the info about the lib: name, description, author, license
// * compiled files are saved in a build folder
@tracend
tracend / underscore.inArray.js
Last active May 26, 2020 13:25
_.inArray() #underscore #mixin #cc
_.mixin({
// - Checks if a string is in an Array
// Source: https://gist.github.com/tracend/570113fcb329aaf69bf0
inArray: function(value, array){
// if not an array just output false
return ( array instanceof Array ) ? (array.indexOf(value) > -1) : false;
}
});
@tracend
tracend / handlebars.copyright.js
Last active August 29, 2015 14:07
Handlebars.copyright: render copyright text #handlebars #helper #cc
@tracend
tracend / handlebars.size.js
Last active August 29, 2015 14:06
Handlebars.size: get the size of an object #handlebars #helper #cc
// Handlebars.size: get the size of an object
// Source: https://gist.github.com/tracend/71e3cb5069edaa0bceae
Handlebars.registerHelper('size', function(obj) {
// prerequisite
if( typeof obj != "object" ) return;
var size = 0, key;
for (key in obj) {
if (obj.hasOwnProperty(key)) size++;
}
return size;
@tracend
tracend / makesites-insider-02-20140917.md
Last active August 29, 2015 14:06
Decentralized is the new Online #article #makesites #insider

Decentralized is the new Online

Our lives are intertwined with the Internet. Our media, our communication, our favorite services, all live online. The "cloud" has evolved from a novelty to an intimate part of our everyday reality. People have already started wondering if our dependence to being online is healthy. But now that we're here, how can we ever go back to living without it?


Let me start with a short disclaimer. This is not going to be an essay infused with nostalgia of the "good ol' days" and cynicism towards the Internet. I love the concept and potential of being online. Everything I produce is published online. My main concern is the way my work is planned and executed, so it is relevant in the upcoming years. Hope you feel the same...

The Internet is Centralized

Some think of it as a network of servers, some as a "series of tubes" but truth of the matter is that the Internet has been re

@tracend
tracend / .terminal.text.md
Last active August 29, 2015 14:06
Terminal Text
@tracend
tracend / underscore.getDir.js
Last active August 29, 2015 14:04
_.getDir() #underscore #mixin #cc
_.mixin({
// - Returns the directory of a url or full path
// Source: https://gist.github.com/tracend/31436d82befafab96d15
getDir: function ( url ) {
// prerequisite
if( typeof url != "string" ) return "";
//
var location = url.match(/^.*[\\\/]/);
// return if there are any matches...
return ( location !== null ) ? location[0] : "";
@tracend
tracend / underscore.isURL.js
Last active August 29, 2015 14:04
_.isURL() #underscore #mixin #cc
_.mixin({
// - Checks if a string is a full URL
// Source: https://gist.github.com/tracend/a522e5a169aad662fa80
isURL: function ( url ) {
// prerequisite
if( typeof url != "string" ) return false;
//
return ( url.substr(0, 4) == "http" || url.substr(0, 2) == "//" );
}
});

Float label

A web component that create a CSS-only floating label for input tags

@tracend
tracend / handlebars.contains.js
Created January 30, 2014 06:08
Handlebars helper: Contains
// Handlebars helper: Contains
// check if a value is contained in an array
Handlebars.registerHelper("contains", function( value, array, options ){
// fallback...
array = ( array instanceof Array ) ? array : [array];
return (array.indexOf(value) > -1) ? options.fn( this ) : "";
});