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 | |
class Dragonball { | |
public $ballCount = 0; | |
public function iFoundaBall() { | |
if ($this->ballCount < 7) { | |
$this->ballCount++; | |
} else { | |
echo("You can ask your wish!"); | |
$this->ballCount = 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
<?php | |
$input = "1,2,3,4,5,6,7"; | |
$sum = 0; | |
print($input); | |
$input_arr = explode(",", $input); | |
foreach($input_arr as &$inp) | |
{ |
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 return an array containing *length* random numbers | |
and having the range from 0 to *max* */ | |
function randomArray(length, max) { | |
return Array.apply(null, Array(length)).map(function() { | |
return Math.round(Math.random() * max); | |
}); | |
} | |
/* function than shuffle an array */ | |
function shuffle(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
/*Query to detect active sessions, in order to kill them in Oracle */ | |
SELECT s.inst_id, | |
s.sid, | |
s.serial#, | |
p.spid, | |
s.username, | |
s.osuser, | |
s.machine, | |
s.program, | |
'ALTER SYSTEM KILL SESSION '''||s.sid||','||s.serial#||''' IMMEDIATE;' as cmd |
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
(defun Hanoi (n origin destination auxiliar) | |
(if (= n 1) (moure 1 origin destination) | |
(progn (Hanoi (- n 1) origin auxiliar destination) | |
(moure n origin destination) | |
(Hanoi (- n 1) auxiliar destination origin)))) | |
(defun moure (k origin destination) | |
(print (list 'move 'disk k | |
'from 'column origin | |
'to 'column destination))) |
NewerOlder