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 / gist:824063
Created February 12, 2011 19:58
Trabalho de Algoritmos na Faculdade, remotos 2008... :s
/*!
* Integrantes:
* - Anderson Fraga
* - Teu Solano
* - Thiago Garcia
*
@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 / 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 / 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 / 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 / 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 / controller.php
Created October 26, 2011 17:19
Proposal Bundle Restful for Symfony
<?php
namespace App;
use Restsym/Controller;
use Restsym/Controller/RespondTo;
use App/News/Repository as DataNews;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
@andersonfraga
andersonfraga / static.js
Created December 6, 2011 17:19
Troca uma imagem em background de segundos em segundos
$j(document).ready(function() {
counter_img = 1;
setInterval(function() {
if(++counter_img > 4) {
counter_img = 1;
}
$j('#topo > h1').animate({
opacity: '0.8'
export PATH=$HOME/local/bin:$PATH
#colors
export CLICOLOR=1
export LSCOLORS=GxFxCxDxegedabagaced
#customize output shel
parse_git_branch () {
git name-rev HEAD 2> /dev/null | sed 's#HEAD\ \(.*\)#(git \1)#'
}
@andersonfraga
andersonfraga / gist:1901838
Created February 24, 2012 16:17
CentOS - php + git
sudo yum install php53u php53u-cli php53u-gd php53u-common php53u-devel php53u-mbstring php53u-mysql php53u-pdo php53u-pecl-apc php53u-pecl-apc-debuginfo php53u-xml php53u-xmlrpc php53u-intl git-all