Skip to content

Instantly share code, notes, and snippets.

View CauanCabral's full-sized avatar

Cauan Cabral CauanCabral

View GitHub Profile
@CauanCabral
CauanCabral / BigInt.cpp
Created April 16, 2011 03:41
BigInt para operção com inteiros gigantes
class BigInt
{
protected:
int length; // tamanho do vetor alocado
public:
int* digitos;
int ultimoDigito; // tamanho do número definido
BigInt()
@CauanCabral
CauanCabral / readme.markdown
Last active August 7, 2016 09:32
Links de artigos/slides para programadores
@CauanCabral
CauanCabral / gearmand.service
Last active January 5, 2017 21:09
Install Gearman 1.1.12 on OpenSuse 13.1
[Unit]
Description=Gearman Job Server
Wants=network.target
[Service]
ExecStart=/usr/local/sbin/gearmand \
--daemon \
--listen=127.0.0.1 \
--pid-file=/var/run/gearman/gearmand.pid \
--log-file=/var/log/gearman/gearmand.log
@CauanCabral
CauanCabral / vagrant_chef_fedora.md
Last active August 29, 2015 13:57
Vagrant + Chef + Fedora

Pré-requisitos

Pacotes do SO (zypper/aptitude...)

  • gcc, make, kernel-devel, ruby (>=2.0), ruby-devel, ruby20-devel

Pacotes do Ruby (gem)

  • gem2.0 install bundler
@CauanCabral
CauanCabral / MyStat.php
Last active August 29, 2015 13:59
Pequeno teste para checar o compartilhamento de informação estática entre processos/requisições
<?php
class MyStat {
protected static $_data = ['initial' => 'default'];
public static function set($key, $value) {
self::$_data[$key] = $value;
}
public static function get($key) {
if (isset(self::$_data[$key])) {
@CauanCabral
CauanCabral / mydoc.php
Last active January 3, 2022 14:25
PHPWord ToC
<?php
require('Vendor/autoload.php');
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$phpWord->setDefaultFontName('Calibri');
$phpWord->setDefaultFontSize(14);
$phpWord->addFontStyle('normal', array(
'color' => '000000',
'bold' => false,
@CauanCabral
CauanCabral / install_gearman.sh
Created July 15, 2014 21:09
Install Gearman latest stable ( 1.0.6 ) in OpenSUSE latest stable ( 13.1 )
#!/bin/bash
# Run this script as root
# ADD REPOSITORY
zypper ar -f http://download.opensuse.org/repositories/server:/monitoring/openSUSE_13.1/ Monitoring
zypper refresh
# INSTALL ALL RELATED PACKAGES
zypper in gearmand-server gearmand-server-mysql gearmand-server-postgresql gearmand-server-sqlite3 gearmand-tools gearmand-devel
@CauanCabral
CauanCabral / Cake\ORM\Table->_insert(App\Model\Entity\Article, array)
Created November 14, 2014 19:02
CakePHP 3 Problem with localized date
object(App\Model\Entity\Article) {
'new' => true,
'accessible' => [
[maximum depth reached]
],
'properties' => [
[maximum depth reached]
],
'dirty' => [
@CauanCabral
CauanCabral / TsvectorType.php
Created February 22, 2015 15:54
CakePHP 3.0 - Textual search support in Postgresql
<?php
namespace App\Database\Type;
use Cake\Database\Driver;
use Cake\Database\Type;
use PDO;
class TsvectorType extends Type
{
@CauanCabral
CauanCabral / .gitignore
Created June 24, 2016 18:32
Global .gitignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
*.class
*.pyo