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 | |
/* | |
The easy way to Convert Decimal to Roman and Roman to Decimal; | |
*/ | |
function ConvertRomawiToDecimal($input){ | |
// Kemungkinan untuk konversi romawi ke desimal ataupun sebaliknya. | |
$possibility = array( | |
'M' => '1000', | |
'CM' => '900', |
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 | |
/* | |
The function for checking characters which appers once in string; | |
*/ | |
function AppearsOnce($input){ | |
if(!ctype_digit($input)){ | |
return "Must be all numbers! "; |
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
const Breadcrumbs = function(title){ | |
this.title = title; | |
this.breadLists = ''; | |
} | |
Breadcrumbs.prototype.add = function(title, url){ | |
var breadArray = []; |
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 ValidationParentesis(string){ | |
return !string.split('').reduce(function(prev, char){ | |
if(prev < 0) { return prev; } | |
if(char === '('){ return ++prev }; | |
if(char === ')'){ return --prev}; | |
return prev; | |
},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 desks = [ | |
{ type: 'sitting' }, | |
{ type: 'standing' }, | |
{ type: 'sitting' }, | |
{ type: 'sitting' }, | |
{ type: 'standing' } | |
]; | |
var deskTypes = desks.reduce(function(sum, desk) { | |
sum[desk.type] += 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
// Creating a function called MagicSelfNumber | |
var MagicSelfNumber = function(max){ | |
//creating an array with defined index | |
this.arrayTemp = Array.apply(null, {length: max}).map(Number.call, Number); | |
this.selfNumber; | |
} | |
//this proto function is for finding all self-numbers | |
MagicSelfNumber.prototype.selfNumber = function(){ |
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
//creating a function call SurvivorGunMen | |
var SurvivorGunMen = function(){ | |
this.wall = 'wall'; | |
this.space= undefined; | |
this.gunman = 'Gunman'; | |
this.room; | |
this.countGunmen = 0; | |
} | |
// this proto func is for creating a new room for gunmen |