Skip to content

Instantly share code, notes, and snippets.

Pablo Rigazzi prigazzi

View GitHub Profile
View gist:f58c972c5678ec7469d5387ca6c84503
<?php
class Injectable
{
public function tomalaToda($argument)
{
return "Comete ". $argument;
}
}
class Golosa
View snake.html
<!documentTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Play Snake Game</title>
<style type="text/css">
body {text-align:center;}
canvas { border:5px dotted #ccc; }
h1 { font-size:50px; text-align: center; margin: 0; padding-bottom: 25px;}
</style>
@prigazzi
prigazzi / Builder.php
Created Sep 3, 2015
A Simple Deferred Object implementation.
View Builder.php
<?php
class Builder
{
public $objects = [];
public $factory = [];
public function factory($name, $callable)
{
$this->factory[$name] = $callable->bindTo($this);
}
@prigazzi
prigazzi / gist:8455010
Created Jan 16, 2014
Recibir en el constructor un array de parámetros indefinidos y procesarlos con un simple método.
View gist:8455010
<?php
class User {
private $_db = null;
private $_log = null;
private $_params = array();
public function __construct(array $params) {
$this->setParams($params);
}
@prigazzi
prigazzi / gist:8454758
Created Jan 16, 2014
Pequeño ejemplo de Lazy Loading en una clase en PHP
View gist:8454758
<?php
class User {
private $_db = null;
public function setDB(DBClass $db) {
return $this->_db = $db;
}
public function getDB() {
if(null == $this->_db) {
@prigazzi
prigazzi / gist:2646543
Created May 9, 2012
Javascript: Plugin base para jQuery
View gist:2646543
;(function( $, window, document, undefined) {
var pluginName = 'ejemplo',
defaults = {
autoExec : true,
autoExecMethod : 'auto',
default : 'values',
}
// Código de inicialización acá
methods = {
You can’t perform that action at this time.