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') |
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 moveCursorToEnd(el) { | |
| if (typeof el.selectionStart == "number") { | |
| el.selectionStart = el.selectionEnd = el.value.length; | |
| } else if (typeof el.createTextRange != "undefined") { | |
| el.focus(); | |
| var range = el.createTextRange(); | |
| range.collapse(false); | |
| range.select(); | |
| } | |
| } |
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
| /** | |
| * Generate random integer from 0 to limit. | |
| */ | |
| function rnd(limit) { | |
| return (Math.random()*limit)|0; | |
| } | |
| /** | |
| * Generate random float value in range. | |
| */ |
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 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
| <html xmlns="http://www.w3.org/1999/xhtml"> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
| <title>Открывающаяся панель на MooTools</title> | |
| <script type="text/javascript" src="mootools.min.js"></script> | |
| <script type="text/javascript"> | |
| window.addEvent('domready', function(){ | |
| var mySlide = new Fx.Slide('section'); | |