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
// Taken from http://stackoverflow.com/questions/728360/copying-an-object-in-javascript | |
clone = function(obj) { | |
if (null == obj || "object" != typeof obj) return obj; | |
var copy = obj.constructor(); | |
for (var attr in obj) { | |
if (obj.hasOwnProperty(attr)) copy[attr] = obj[attr]; | |
} | |
return copy; | |
} |
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
// Taken from http://stackoverflow.com/questions/1267283/how-can-i-create-a-zerofilled-value-using-javascript | |
paddy = function(n, p, c) { | |
var pad_char = typeof c !== 'undefined' ? c : '0'; | |
var p = typeof c !== 'undefined' ? p : 2; | |
var pad = new Array(1 + p).join(pad_char); | |
return (pad + n).slice(-pad.length); | |
} |
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
// Inspired from http://stackoverflow.com/questions/2900333/javascript-how-to-compare-multiple-variables-value | |
is_null_or_undef = function(args) { | |
for (var i =0; i < arguments.length; i++) { | |
if (arguments[i] == null || typeof arguments[i] === 'undefined') { | |
return true; | |
} | |
} | |
return false; | |
} |
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
set_default_arg = function(arg, default_value) { | |
if (arg === null || typeof arg === 'undefined') { | |
return default_value; | |
} | |
return arg; | |
} |
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
// Taken from http://stackoverflow.com/questions/1129216/sorting-objects-in-an-array-by-a-field-value-in-javascript | |
dynamic_sort = function(property) { | |
var sort_order = 1; | |
if(property[0] === "-") { | |
sort_order = -1; | |
property = property.substr(1, property.length - 1); | |
} | |
return function (a,b) { | |
var result = (a[property] < b[property]) ? -1 : (a[property] > b[property]) ? 1 : 0; | |
return result * sort_order; |
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
// Inspired from http://stackoverflow.com/questions/2771609/how-to-ignore-users-time-zone-and-force-date-use-specific-time-zone | |
function adjust_date_timezone(date, timezone_hours_offset, local_offset) { | |
date = set_default_arg(date, new Date()); | |
timezone_hours_offset = !(timezone_hours_offset === null || typeof timezone_hours_offset === 'undefined') ? timezone_hours_offset: optools_settings.timezone_hours_offset; | |
local_offset = !(local_offset === null || typeof local_offset === 'undefined') ? local_offset: date.getTimezoneOffset() *60*1000; | |
return new Date(date.getTime() + local_offset + (timezone_hours_offset *60*60*1000)); | |
}; |
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
/** | |
* Taken from: http://php.net/manual/en/function.strrchr.php | |
* | |
* Removes the preceeding or proceeding portion of a string | |
* relative to the last occurrence of the specified character. | |
* The character selected may be retained or discarded. | |
* | |
* Example usage: | |
* <code> | |
* $example = 'http://example.com/path/file.php'; |
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
// Taken from http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values | |
getParameterByName = function(name) { | |
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); | |
var regexS = "[\\?&]" + name + "=([^&#]*)"; | |
var regex = new RegExp(regexS); | |
var results = regex.exec(window.location.search); | |
if(results == null) | |
return ""; | |
else | |
return decodeURIComponent(results[1].replace(/\+/g, " ")); |
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
$default_rounded_amount: 5px | |
// Round corner at position by amount. | |
@mixin round-corner($position, $amount: $default_rounded_amount) | |
border-#{$position}-radius: $amount | |
-webkit-border-#{$position}-radius: $amount | |
@mixin round-corner-mozilla($position, $amount: $default_rounded_amount) | |
-moz-border-radius-#{$position}: $amount | |
// Round left corners by amount |
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
%pseudo-content-before { | |
position: relative; | |
&:before { | |
content: " "; | |
position: absolute; | |
display: block; | |
} | |
} | |
%pseudo-content-after { |
OlderNewer