Skip to content

Instantly share code, notes, and snippets.

View andersonfraga's full-sized avatar
🧩
Focusing

Anderson Fraga andersonfraga

🧩
Focusing
View GitHub Profile
@andersonfraga
andersonfraga / float_a.php
Created September 15, 2011 20:38
PHP e suas comparações
<?php
$x1 = (float) "111111111111111111111111111111111111111111111111111111112";
$x2 = (float) "111111111111111111111111111111111111111111111111111111111";
var_dump($x1);
var_dump($x2);
if($x1 == $x2){
echo "iguais";
}
@andersonfraga
andersonfraga / author.php
Last active April 1, 2020 12:17
Spell : IdentityMap, ORM...
<?php
namespace Spell\Entity\Author;
use Spell\Column\Serial as Serial,
Spell\Column\Str as Str;
class Author {
public $id, $name, $uri;
@andersonfraga
andersonfraga / sieve.php
Created June 26, 2011 03:18
Eratostenes Sieve
<?php
function eratostenes_sieve($number) {
$num_max = floor(sqrt($number));
$list = range(2, $number);
for($x = 2; $x <= $num_max; $x++) {
foreach($list as $_k => $_val) {
if($_val != $x and $_val % $x == 0) {
unset($list[$_k]);
@andersonfraga
andersonfraga / noticia.php
Created February 22, 2011 17:16
Controller para CRUD e com suporte à XML e JSON um tanto quanto minimalista...
<?php
class NoticiaConteudoController extends RestritoController {
function dependency() {
return Array(
'noticia' => '@NoticiaConteudoModel',
'autor' => '@AutorModel',
);
}
@andersonfraga
andersonfraga / gist:824075
Created February 12, 2011 20:16
2º Trabalho de Algoritmos... Remotos 2008
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <conio.h>
#include <io.h>
@andersonfraga
andersonfraga / gist:824063
Created February 12, 2011 19:58
Trabalho de Algoritmos na Faculdade, remotos 2008... :s
/*!
* Integrantes:
* - Anderson Fraga
* - Teu Solano
* - Thiago Garcia
*