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 getVar($var){ | |
return isset($_GET[$var]) ? $_GET[$var] : 0; | |
} | |
function getReportSetting($var){ | |
global $reportSetting; | |
return isset($reportSetting[$var]) ? $reportSetting[$var] : 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
var observeDOM = (function(){ | |
var MutationObserver = window.MutationObserver || | |
window.WebKitMutationObserver; | |
return function(obj, thistime, callback){ | |
if(typeof obj === 'undefined'){ | |
console.log('obj is undefined'); | |
return; | |
} |
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 frequency(array_elements) { | |
array_elements.sort(); | |
var current = null; | |
var cnt = 0; | |
var result = []; | |
for (var i = 0; i < array_elements.length; i++) { | |
if (array_elements[i] != current) { | |
if (cnt > 0) { | |
result.push([current, cnt]); |
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
/* | |
* @param1 = string | |
* return boolean | |
*/ | |
function isUniqueCharater(str){ | |
return str.length === new Set(str).size; | |
} |
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 frequency(array_elements){ | |
return array_elements.sort().reduce((b,c)=>((b[b.findIndex(d=>d[0]===c)]||b[b.push([c,0])-1])[1]++,b),[]); | |
} |
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 print_numbers() | |
{ | |
for(var i = 1; i <= 200; i++) | |
{ | |
var str = ""; | |
if(i % 3 == 0) | |
{ | |
str = " Blue"; | |
} | |
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 is_palindrome(str) | |
{ | |
if(str.length == 1) return true; | |
var lowStr = str.toLowerCase().replace(/[\W]/g, ''); | |
return lowStr.split('').reverse().join('') === lowStr; | |
} |
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 square_first_200() | |
{ | |
var result = []; | |
for(var i = 1; i <= 200; i++) | |
{ | |
result.push(i*i); | |
} | |
return result; |
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 factorial(number) | |
{ | |
if(number < 1) return 1; | |
return number * factorial(number - 1); | |
} |
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
<?php | |
# copy right Fermin Perdomo | |
interface day { | |
public function whatYouDoing(); | |
} | |
class Holiday implements day { | |
protected $dayName = ""; |