Skip to content

Instantly share code, notes, and snippets.

👀
overlooking issues

Guilherme Ventura danguilherme

👀
overlooking issues
Block or report user

Report or block danguilherme

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@danguilherme
danguilherme / Enum.js
Last active Aug 29, 2015
JavaScript Enum
View Enum.js
function Enum(items, startingValue) {
var count = startingValue || 0,
item;
for (var i = 0; i < items.length && (item = items[i]) ; i++) {
var splitted = item.split(':');
if (splitted.length == 2) {
count = Number(splitted[0]);
item = splitted[1];
}
this[this[item] = count++] = item;
View loadScript.js
function loadScript(url,callback) {
var element = document.createElement("script");
element.src = url;
document.body.appendChild(element);
element.onload = callback;
return element;
}
You can’t perform that action at this time.