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 x(a,b){ | |
a = a || 10; | |
b = b || 12; | |
console.log(a); | |
console.log(b); | |
} | |
x(); | |
// 10 |
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 IsJsonString(str) { | |
try { | |
JSON.parse(str); | |
} catch (e) { | |
return false; | |
} | |
return true; | |
} |
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 scrollToPlace(selector,scrollTime,additionalToOffset) { | |
jQuery('html, body').animate({ | |
scrollTop: jQuery(selector).offset().top - additionalToOffset | |
}, scrollTime); | |
} |
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 search = ['Á','Â','Á','Ã','É','Ê','Í','Ó','Ô','Õ','Ú','Ç','á','â','ã','é','ê','í','ó','ô','õ','ú','ç','À','à'] | |
var replace= ['a','a','a','a','e','e','i','o','o','o','u','c','a','a','a','e','e','i','o','o','o','u','c','a','a']; | |
var string = 'Ele eé um homem'; | |
for (var i = 0; search.length > i; i++) { | |
if (string.indexOf(search[i]) != -1) { | |
string = string.replace(search[i],replace[i]); | |
} | |
} |
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 to query a given post type and to build array of the avialable titles. Used for select lists | |
* Used by: | |
* | |
* @param string $post_type Post type | |
* @return array $pairs Associative array with key[post id] and value[post title] | |
*/ | |
function get_post_type_list_of_posts($post_type){ | |
$pairs = array(); |
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 a; | |
var b = ""; | |
var c = 0; | |
var d = null; | |
var e = []; | |
var f = {}; | |
var g = false; | |
console.log("a: " + typeof a); // "undefined" |
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
console.log(null == undefined); // TRUE | |
console.log(null === undefined); // FALSE | |
console.log(null == ""); // FALSE | |
console.log(null == 0); // FALSE | |
console.log(undefined == ""); // FALSE | |
console.log(undefined == 0); // FALSE | |
console.log("" == 0); // TRUE | |
console.log("" === 0); // FALSE | |
console.log(false == 0); // TRUE | |
console.log(false == ""); // TRUE |
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 str = "string"; | |
var num = 123; | |
var boo = false; | |
var obj = {h:3}; | |
console.log(String(str)); // "string" | |
console.log(Number(str)); // NaN | |
console.log(Boolean(str)); // true | |
console.log(Object(str)); // "string" |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<style id="jsbin-css"> | |
.verb-wrapper{ | |
width:400px; | |
border: 1px solid green; |
OlderNewer