This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* hasFirebug.js, alternate version - detects the activation status of firebug | |
* @author Livingston Samuel | |
*/ | |
var hasFirebug = (function () { | |
return !!(window.console && window.console.firebug) | |
}()); | |
/* | |
hasFirebug => false, if Firebug is not installed or not activated for the current page |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* formatCurrency.js - number to currency formatting | |
* @author - Livingston Samuel | |
*/ | |
var formatCurrency = function (num, separator, decimal) { | |
var format_separator = separator || ",", | |
decimal_separator = decimal || ".", | |
parts = parseFloat(num, 10).toString().split(decimal_separator); | |
parts[0] = parts[0].split("").reverse().join("").match(/(\d{1,3})/g).join(format_separator).split("").reverse().join(""); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* IP2Decimal.js - converts IP address to decimal format | |
* @author - Livingston Samuel | |
*/ | |
var IP2Decimal = function (ip) { | |
var ipSyntax = /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/, ipArr, i = 4, decVal = 0; | |
if (ipSyntax.test(ip)) { | |
ipArr = ip.split("."); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* String.pad.js - String prototype method to pad string with specified character, with defined length | |
* @author - Livingston Samuel | |
*/ | |
String.prototype.pad = function (char, len) { | |
var str = this, l = str.length; | |
if (arguments.length !== 2 || String(char).length !== 1 || str.length >= len) { | |
return str; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* IP2Octal.js - converts IP address to Octal format | |
* @author - Livingston Samuel | |
* | |
* @requires - padString.js - http://gist.github.com/275259#file_pad_string.js | |
*/ | |
var IP2Octal = function (ip) { | |
var ipSyntax = /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/, ipArr, i = 4, result = []; | |
if (ipSyntax.test(ip)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Photoshop Script for Optimizing Images for the Web - Saves images as optimized jpeg | |
// Written by: Livingston Samuel | |
// Version 1.0.0 | |
// Required Adobe Photoshop CS 2 and above | |
//Enable double clicking on Mac Finder & Windows Explorer | |
#target Photoshop | |
//Bring app to front | |
app.bringToFront() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Collection of DOM Helper Methods | |
* Livingston Samuel | |
*/ | |
var DOM = {}; | |
/* Get Next Element node Sibling - Equivalent of nextElementSibling */ | |
DOM.next = function (elem) { | |
var sibling = elem.nextSibling; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Optimized Google Analytics Tracker code | |
// http://mathiasbynens.be/notes/async-analytics-snippet | |
var _gaq = [['_setAccount', 'UA-XXXXX-X'], ['_trackPageview']]; | |
// replace XXXXX-X with your tracking id | |
(function(d, t) { | |
var s = d.getElementsByTagName(t)[0], | |
g = d.createElement(t); | |
g.async = !0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 1. Life, the Universe, and Everything | |
Problem code: TEST | |
Your program is to use the brute-force approach in order to find the Answer to Life, the Universe, and Everything. | |
More precisely... rewrite small numbers from input to output. Stop processing input after reading in the number 42. | |
All numbers at input are integers of one or two digits. | |
Example: | |
Input: 1 2 88 42 99 | |
Output: 1 2 88 | |
*/ |
OlderNewer