Skip to content

Instantly share code, notes, and snippets.

View dextervip's full-sized avatar

Rafael Amorim dextervip

  • São Paulo, Brasil
View GitHub Profile
@dextervip
dextervip / todo.php
Created September 28, 2012 03:18 — forked from alganet/todo.php
A very small PHP todo list that saves to the database in 32 lines
<?php
//The actual implementation is just this file. Others are usage and tests.
class TodoList extends ArrayObject
{
const CREATE = 'CREATE TABLE IF NOT EXISTS tasks (name VARCHAR(32) PRIMARY KEY, status INT)';
const SELECT = 'SELECT * FROM tasks';
const INSERT = 'INSERT INTO tasks VALUES (?,?)';
const UPDATE = 'UPDATE tasks SET status = ? WHERE name = ?';
@dextervip
dextervip / BusinessDaysTest.php
Created September 28, 2012 03:16 — forked from netojoaobatista/BusinessDaysTest.php
Algorítimo idiota (e caro) para cálculo de dias úteis entre duas datas.
<?php
require_once 'PHPUnit/Framework/TestCase.php';
require_once 'businessDays.php';
/**
* businessDays() test case.
*/
class BusinessDaysTest extends PHPUnit_Framework_TestCase {
protected function setUp() {
parent::setUp();