Skip to content

Instantly share code, notes, and snippets.

View pateketrueke's full-sized avatar

Alvaro Cabrera Durán pateketrueke

View GitHub Profile
@pateketrueke
pateketrueke / heroku.log
Created October 20, 2011 20:13
Current output from "heroku logs"
After push:
2011-10-20T20:00:03+00:00 heroku[api]: Deploy cf9e66c
2011-10-20T20:00:03+00:00 heroku[api]: Release v50 created by pateketrueke@gmail.com
2011-10-20T20:00:06+00:00 heroku[slugc]: Slug compilation finished
2011-10-20T20:00:44+00:00 heroku[web.1]: Starting process with command `sh boot.sh`
2011-10-20T20:00:44+00:00 app[web.1]: Launching apache
2011-10-20T20:00:45+00:00 heroku[web.1]: State changed from starting to up
2011-10-20T20:00:45+00:00 app[web.1]: PHP Warning: PHP Startup: Unable to load dynamic library '/app/www/lib/soap.so' - /app/www/lib/soap.so: cannot open shared object file: No such file or directory in Unknown on line 0
2011-10-20T20:00:45+00:00 app[web.1]: [Thu Oct 20 20:00:44 2011] [notice] Apache/2.2.19 (Unix) PHP/5.3.6 configured -- resuming normal operations
@pateketrueke
pateketrueke / klass.php
Created May 9, 2012 16:19
Klass Implementation for PHP 5.4+
<?php
class Klass {
private $props = array();
public function __construct(array $params = array()) {
$this->props = $params;
}
public function __call($method, $arguments) {
if ($item = $this->$method) {
if ($item instanceof Closure) {
@pateketrueke
pateketrueke / xhprof-example.php
Created May 22, 2012 21:30
XHProf hook example
<?php
call_user_func(function () {
register_shutdown_function(function () {
$data = xhprof_disable();
$obj = new XHProfRuns_Default();
$obj->save_run($data, 'MyApp');
});
@pateketrueke
pateketrueke / .bashrc
Last active October 5, 2015 07:37
My functions; with php's built-in web server
rand_port(){
port=$(( 1234+( $(od -An -N2 -i /dev/random) )%(1023+1) ))
while :
do
(echo >/dev/tcp/localhost/$port) &>/dev/null && port=$(( 1234+( $(od -An -N2 -i /dev/random) )%(1023+1) )) || break
done
echo "$port"
}
phpmin(){
@pateketrueke
pateketrueke / auth-example.php
Created May 28, 2012 05:17
Basic auth with tetl::PHP
<?php
require 'tetlphp/framework/initialize.php';
import('db');
import('www');
import('a_record');
run(function () {
@pateketrueke
pateketrueke / composer.json
Created May 28, 2012 05:42
Default composer configuration for tetl::PHP
{
"repositories": {
"pateketrueke": {
"package": {
"name": "tetlphp",
"version": "trunk",
"dist": {
"url": "https://github.com/pateketrueke/tetlphp/zipball/master",
"type": "zip"
}
@pateketrueke
pateketrueke / composer-example.php
Created May 28, 2012 05:45
Example loading through the Composer to run tetl:::PHP
<?php
require 'vendor/tetlphp/framework/initialize.php';
import('www');
run(function () {
root(function () {
echo 'Hello ', link_to('World', url_for::some_action());
@pateketrueke
pateketrueke / .bashrc
Created June 8, 2012 05:54
Zsh '$ vh' clone; works on Ubuntu/Mac OSX (fixed)
vh(){
paths[0]="/etc/apache2/sites-available"
paths[1]="/etc/apache2/extra/httpd-vhosts.conf"
paths[2]="/private/etc/apache2/virtualhosts"
paths[3]="/private/etc/apache2/extra/httpd-vhosts.conf"
for i in 0 1 2 3
do
if [ -f "${paths[$i]}" ] || [ -d "${paths[$i]}" ]; then
conf="${paths[$i]}"
@pateketrueke
pateketrueke / gist:2943149
Created June 17, 2012 02:06
Autoupload backtrace (manual)
ek@lamat:~/.local/lib/git/autoupload$ ruby listen.rb
/home/ek/.local/lib/git/autoupload/uploads/screenshot4.png
http://i.imgur.com/miGkN.png
/home/ek/.local/lib/git/autoupload/uploads/.listen_test
/home/ek/.local/lib/git/autoupload/imgur.rb:21:in `upload': undefined method `[]' for nil:NilClass (NoMethodError)
from /home/ek/.local/lib/git/autoupload/imgur.rb:27:in `upload_file'
from listen.rb:19:in `block in <main>'
from /usr/local/lib/ruby/gems/1.9.1/gems/listen-0.4.5/lib/listen/listener.rb:190:in `call'
from /usr/local/lib/ruby/gems/1.9.1/gems/listen-0.4.5/lib/listen/listener.rb:190:in `on_change'
from /usr/local/lib/ruby/gems/1.9.1/gems/listen-0.4.5/lib/listen/listener.rb:199:in `block in initialize_adapter'
@pateketrueke
pateketrueke / php.ini
Created July 14, 2012 19:28
My default php.ini for PHP 5.4 under Windows7
[PHP]
;;;;;;;;;;;;;;;;;;;
; About php.ini ;
;;;;;;;;;;;;;;;;;;;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.
; PHP attempts to find and load this configuration from a number of locations.