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 / 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 / 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 / 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:b5d6ecae31f6b387f0c9
Last active August 29, 2015 14:14
Exemplo de vaga
<?php
class Vaga
{
private $requisitos = [];
private $to = [];
public function __construct() {}
@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);
##############################################################################
# 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 / File.php
Created June 1, 2015 20:53
Class File
<?php
namespace FileComponent;
/**
* Class File
* @package FileComponent
*/
class File
{
@igor822
igor822 / configurator_mac.sh
Created June 18, 2015 11:43
Symfony environment configurator
#!/bin/sh
path_project="$1"
DISTRO="unknown"
if [[ -z $path_project ]]; then
echo "Please add the path of project"
exit 1
fi
@igor822
igor822 / learn-oop.md
Created September 13, 2015 16:22
Learn OOP with PHP
@igor822
igor822 / boot-usb.sh
Created April 9, 2016 12:33
Boot USB using Qemu
# lsusb to get bus and id
# https://weluse.de/blog/test-your-bootable-usb-drive-with-qemu.html
sudo qemu-system-x86_64 -m 512 -enable-kvm -usb -device usb-host,hostbus=1,hostaddr=8