Skip to content

Instantly share code, notes, and snippets.

View igor822's full-sized avatar

Igor Carvalho igor822

  • Instafreight
  • Berlin
View GitHub Profile
@igor822
igor822 / File.php
Created June 1, 2015 20:53
Class File
<?php
namespace FileComponent;
/**
* Class File
* @package FileComponent
*/
class File
{
##############################################################################
# INSTALL isolated PHP 5.6 ZTS (Thread-safe) with pthreads on Ubuntu 14.04 ###
##############################################################################
1) Install necessary bison version
apt-get install m4
wget http://launchpadlibrarian.net/140087283/libbison-dev_2.7.1.dfsg-1_amd64.deb
wget http://launchpadlibrarian.net/140087282/bison_2.7.1.dfsg-1_amd64.deb
@igor822
igor822 / Thumb.php
Last active August 29, 2015 14:18 — forked from thomaspiedade/Thumb.php
<?php
class Thumb
{
private $proportional;
public function make(UploadedFile $file, $path , $name, $maxWidth, $maxHeight)
{
if (!File::isDirectory(public_path() . $path)) {
File::makeDirectory(public_path() . $path, $mode = 0777, true, true);
@igor822
igor822 / gist:b5d6ecae31f6b387f0c9
Last active August 29, 2015 14:14
Exemplo de vaga
<?php
class Vaga
{
private $requisitos = [];
private $to = [];
public function __construct() {}
@igor822
igor822 / vimrc.sh
Last active August 29, 2015 14:03
Meu Vim
syntax enable
set encoding=utf-8
set t_Co=256
set tabstop=4
set shiftwidth=4
set expandtab
set lazyredraw
set laststatus=2
set nocompatible
@igor822
igor822 / gist:f3e62ba7106d1d8be464
Last active August 29, 2015 14:03
Contador de palavras
<?php
function removerAcento($string) {
$from = "áàãâéêíóôõúüçÁÀÃÂÉÊÍÓÔÕÚÜÇ";
$to = "aaaaeeiooouucAAAAEEIOOOUUC";
$keys = array();
$values = array();
preg_match_all('/./u', $from, $keys);
preg_match_all('/./u', $to, $values);
$mapping = array_combine($keys[0], $values[0]);
return strtr($string, $mapping);
@igor822
igor822 / reflect_class.php
Created June 13, 2014 15:01
Execute a private method in PHP
<?php
class A {
private function teste() {
return 'teste ab';
}
}
$class = new A();
@igor822
igor822 / Steps
Created March 10, 2014 14:39
Tutorial XDebug + PHPUnit + Sublime Text 3
Plugin: https://github.com/martomo/SublimeTextXdebug
Command: phpunit -d xdebug.profiler_enable=on -d xdebug.idekey=sublime.xdebug File.php
Configuration Xdebug:
xdebug.remote_enable = 1
xdebug.remote_handler = dbgp
xdebug.remote_host = 127.0.0.1
xdebug.remote_port = 9000
@igor822
igor822 / autoload.php
Created February 13, 2014 16:54
Simple autoload
<?php
if (!defined('BASE_PATH')) define('BASE_PATH', realpath(dirname(__FILE__))); // Root path folder to load classes
function autoloader($class_name) {
$class_name = ltrim($class_name, '\\');
$file_name = '';
$namespace = '';
if ($lastNsPos = strrpos($class_name, '\\')) {
$namespace = substr($class_name, 0, $lastNsPos);
$class_name = substr($class_name, $lastNsPos + 1);
@igor822
igor822 / phpunit_fedora.sh
Created February 12, 2014 12:28
Install PHPUnit with PEAR in Fedora 20
yum install php-pear
# Discovering all channels
pear channel-discover pear.phpunit.de
pear channel-discover pear.symfony-project.com
pear channel-discover components.ez.no
# Install PHPUnit with Yaml
pear install pear.symfony.com/Yaml
pear install --alldeps pear.phpunit.de/PHPUnit