Skip to content

Instantly share code, notes, and snippets.

View pedrochaves's full-sized avatar

Pedro Chaves pedrochaves

View GitHub Profile
@pedrochaves
pedrochaves / php52.php
Last active August 29, 2015 14:24
namespaces
<?php
// Google/Client.php
class Google_Client
{
}
// Google/Service/Drive.php
class Google_Service_Drive
<?php
function odd($number)
{
return $number % 2 === 0;
}
$numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
$odds = array_filter($numbers, 'odd');
$even = array_filter($numbers, function($number) {
@pedrochaves
pedrochaves / fibonacci.clj
Last active January 14, 2020 21:02
Fibonacci em Clojure
(defn !
[number]
(reduce * 1 (range 1 (inc number))))
#(reduce * 1 (range 1 (inc %)))
(defn !
[number]
(loop [current number
factorial number]