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 max(a,b,c){ | |
var maxValue = Number.NEGATIVE_INFINITY; | |
for(var i = 0; i<arguments.length; i++) | |
if(maxValue < arguments[i]) | |
maxValue = arguments[i]; | |
return maxValue; | |
}; |
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
var scroll = function( srollFromEl, srollToEl ){ | |
srollFromEl.click(function( e ){ | |
e.preventDefault(); | |
$('html, body').stop().animate({ | |
'scrollTop': srollToEl.offset().top | |
}, 900, 'swing'); | |
}); |
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 isNumeric(n) { | |
return !isNaN(parseFloat(n)) && isFinite(n); | |
}; |
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 buildString(){ | |
var args = Array.prototype.slice.call(arguments).join(''); | |
return args; | |
} |
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
$browser-context: 18px; | |
@function em($pixels, $context: $browser-context) { | |
@return ($pixels / $context) * 1em; | |
} |
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
var arr = [[3,1,1,1], | |
[1,1,1,1], | |
[1,1,1,1], | |
[1,1,1,1]]; | |
var sum = arr.reduce(function(prev,cur,i){ | |
return prev+cur[i]+cur[arr.length-1-i]; | |
},0); |
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 isInteger(num) { | |
return (num ^ 0) === num; | |
} |
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
<?php | |
if(isset($_POST) && is_array($_POST) && count($_POST) > 0){ | |
$ajaxResp = []; | |
if(isset($_POST['email']) && filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)){ | |
$ajaxResp['status'] = 1; | |
$ajaxResp['email'] = $_POST['email']; | |
echo json_encode($ajaxResp); | |
} else { | |
$ajaxResp['status'] = 0; |
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 Animal(voice){ | |
this.voice = voice || 'grunt'; | |
} | |
Animal.prototype.speak = function(){ | |
console.log(this.voice); | |
} | |
function Cat(name, color){ | |
Animal.call(this, 'Meow'); | |
this.name = name; |
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 getCurrentPositionUsGeoAndIp(){ | |
var D = $.Deferred(); | |
try{ | |
//using navigator geolocation | |
if( navigator.geolocation ){ | |
navigator.geolocation.getCurrentPosition( foundCordsUseGeoSuccess, foundCordsUseGeoFail ); |
OlderNewer