This file contains 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
/** | |
check two string respresentations of versions. | |
returns true if the version to test is equal or greater than the required minimum version | |
returns false if the test version is lower than the minimum version | |
@param {String} minVersion Minimum required version to test against | |
@param {String} testVersion Version to test | |
@return {Boolean} | |
This file contains 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
//Loads CSS files into the head of the current document | |
//using arguments to reference any number of styles | |
function loadStyles(){ | |
var i = 0, | |
d = document, | |
s = d.createElement("link"), | |
h = d.getElementsByTagName('head')[0], | |
createStyle = function(src){ | |
s = s.cloneNode(false); | |
s.rel ="stylesheet"; |
This file contains 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
function replaceURLWithHTMLLinks(text) { | |
var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig; | |
return text.replace(exp,"<a href='$1' target='_blank'>$1</a>"); | |
} |
This file contains 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
/** | |
Turn a text input into a search input with added behavior | |
On focus, if input value is the same as defaultValue, replace with blank | |
On blur, if input value is empty or full of whitespace replace with defaultValue | |
@param input {HTMLInputElement} element to behave as search input | |
@param defaultValue {String} string to be default value of the input | |
**/ | |
function makeSearchInput(input, defaultValue){ | |
input.setAttribute("data-default", defaultValue); |
This file contains 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
/* | |
Use, reuse but don't abuse! | |
Author: Razvan Caliman (razvan.caliman@gmail.com) | |
This is an example of a "Multiton" pattern; | |
Create a fixed number of instances of a class. | |
Use "lazy instantiation" to create objects only if needed. | |
If the maximum number of instances has been reached, return a random one from the ones created. | |
*/ |
This file contains 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
#!/bin/sh | |
# USE AT YOUR OWN RISK. Tested on Ubuntu 11.04 with apache2. | |
# CHECK COMMENTS BEFORE RUNNING | |
# this script creates localhost website folder and adds virtualhost | |
# website name - it will append .lh for the path | |
# ex.: 'example' will be accessed as example.lh in the browser | |
website="$@" | |
if [ -z "$website" ]; then | |
echo "No website, no fun." |
This file contains 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
<script type="text/javascript"> | |
function fn(){ | |
//missing var declaration exposes 'x' to global scope | |
x = "surprise!" | |
//by using var 'y' remains private inside the instance of 'fn' | |
var y = "really private!" | |
} |
This file contains 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
(function($){ | |
$(function(){$("#r_sidebar, #l_sidebar").remove(); $("#contentleft").css("width","960px") }); | |
})(jQuery) | |
This file contains 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
/* Region related style for redirecting content flows */ | |
#article { | |
flow-into: article_flow; | |
} | |
#region1, #region2, #region3, #region4 { | |
flow-from: article_flow; | |
} | |
/* positioning and sizing of the region elements */ |
This file contains 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
// idea from https://github.com/bartaz/impress.js | |
var arrayify = function ( a ) { | |
return Array.prototype.slice.call( a ); | |
}; |