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
;(function(window) { | |
'use strict'; | |
/** | |
* AsyncQueue allows you to create a queue of function to be executed via | |
* setTimout that guaranteed to run in order. This can enable to run | |
* process-intensive operations without locking up UI. | |
* | |
* @constructor |
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
/** | |
* JSON response from controller's action. | |
*/ | |
public function run( ) | |
{ | |
JFactory::getDocument()->setMimeEncoding( 'application/json' ); | |
JResponse::setHeader('Content-Disposition','attachment;filename="progress-report-results.json"'); | |
$data = array( | |
'foo' => 'bar' |
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
<!DOCTYPE html> | |
<!--[if lt IE 7 ]> <html class="ie6" lang="en"> <![endif]--> | |
<!--[if IE 7 ]> <html class="ie7" lang="en"> <![endif]--> | |
<!--[if IE 8 ]> <html class="ie8" lang="en"> <![endif]--> | |
<!--[if IE 9 ]> <html class="ie9" lang="en"> <![endif]--> | |
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en"> <!--<![endif]--> | |
<body></body> | |
</html> |
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
// Usage of SymbolPath as a marker icon | |
var marker = new google.maps.Marker({ | |
position: new google.maps.LatLng(-122.5,47.5), | |
icon: { | |
path: google.maps.SymbolPath.CIRCLE, | |
fillOpacity: 0.5, | |
fillColor: 'ff0000', | |
strokeOpacity: 1.0, | |
strokeColor: 'fff000', | |
strokeWeight: 3.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
/* 5 degree */ | |
filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.99, M12=-0.08, M21=0.08, M22=0.99, SizingMethod="auto expand"); | |
/* | |
m11 = sin (5 * pi / 180) | |
m12 = cos (5 * pi / 180) | |
m21 = cos (5 * pi/ 180) | |
m22 = sin (5 * pi / 180) | |
*/ |
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
function getSupportedTransform() { | |
var prefixes = 'transform WebkitTransform MozTransform OTransform msTransform'.split(' '); | |
for(var i = 0; i < prefixes.length; i++) { | |
if(document.createElement('div').style[prefixes[i]] !== undefined) { | |
return prefixes[i]; | |
} | |
} | |
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
// Implementation of Knuth shuffle: http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle | |
// More implementations: http://stackoverflow.com/questions/6274339/how-can-i-shuffle-an-array-in-javascript | |
var shuffle = function(a) { | |
for (var i = a.length; --i > 0;) { | |
// Get random number between first and current index. | |
var r = Math.floor(Math.random() * (i + 1)); | |
// Swap random with current index values. | |
var d = a[r]; | |
a[r] = a[i]; | |
a[i] = d; |
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
// Compose function | |
var cleanArray = _.compose(_.compact, _.uniq, _.flatten); | |
result = cleanArray(lottery); | |
// Chainable way | |
result = _.chain(lottery) | |
.flatten() | |
.uniq() | |
.compact() | |
.value() |
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
// Create hash | |
$bcrypt = new Bcrypt(); | |
$bcrypt->setSalt('abcdefghijklmnopqrstufwxyz'); | |
$password = 'dima'; | |
$hash = $bcrypt->create($password); | |
// Verify password | |
if ($bcrypt->verify($password, $hash)) { | |
echo "And there was much rejoicing"; | |
} else { |
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
var isChecked = $('input[type="checkbox"]').is(':checked') |