Skip to content

Instantly share code, notes, and snippets.

View xthiago's full-sized avatar

Thiago Rodrigues (xthiago) xthiago

View GitHub Profile
@xthiago
xthiago / Docker-for-Mac-with-host-address-alias.md
Last active March 18, 2017 14:52 — forked from ralphschindler/README.md
Docker (For Mac) De-facto Host Address Alias (10.254.254.254) - "The 10254 Trick".

Docker (Mac) De-facto Standard Host Address Alias

This launchd script will ensure that your Docker environment on your Mac will have 10.254.254.254 as an alias on your loopback device (127.0.0.1). The command being run is ifconfig lo0 alias 10.254.254.254

Installation

Copy/Paste the following in terminal with sudo (must be root as the target directory is owned by root)...

sudo curl -o /Library/LaunchDaemons/com.ralphschindler.docker_10254_alias.plist https://gist.githubusercontent.com/ralphschindler/535dc5916ccbd06f53c1b0ee5a868c93/raw/com.ralphschindler.docker_10254_alias.plist
@xthiago
xthiago / Vaga-UPX-Backend-Senior.md
Last active December 20, 2016 18:37
Vaga para Desenvolvedor Backend Sênior na UPX (em Campinas)

Desenvolvedor Backend Sênior [Campinas-SP]

Descrição da vaga

Estamos buscando um Desenvolvedor Backend Sênior que nos auxiliará na construção da nossa arquitetura de backend para os próximos anos. Ele será responsável por:

  • Ajudar a desenhar a arquitetura de backend;
  • Garantir alta performance do backend;
  • Garantir baixo acoplamento da aplicação;
  • Escrever código limpo e que é referência para os demais desenvolvedores;
@xthiago
xthiago / Vaga-UPX-Frontend-Senior.md
Last active December 20, 2016 18:29
Vaga para Desenvolvedor Frontend Sênior na UPX (em Campinas)

Desenvolvedor Frontend Sênior [Campinas-SP]

Descrição da vaga

Estamos buscando um Desenvolvedor Frontend Sênior que nos auxiliará na construção da nossa arquitetura de front-end para os próximos anos. Ele será responsável por:

  • Prototipar e criar interfaces de usuário;
  • Garantir a componentização de objetos de interface, criando e/ou evoluindo componentes e explicando como utilizá-los;
  • Garantir alta performance do front-end;
  • Garantir baixo acoplamento do Core da aplicação com frameworks JavaScript;
@xthiago
xthiago / 60-jetbrains.conf
Created October 18, 2016 13:24 — forked from bittner/60-jetbrains.conf
Inotify configuration for IntelliJ IDEA (PhpStorm, PyCharm, RubyMine, WebStorm). Create this file with e.g. `sudo vim /etc/sysctl.d/60-jetbrains.conf`
# Set inotify watch limit high enough for IntelliJ IDEA (PhpStorm, PyCharm, RubyMine, WebStorm).
# Create this file as /etc/sysctl.d/60-jetbrains.conf (Debian, Ubuntu), and
# run `sudo service procps start` or reboot.
# Source: https://confluence.jetbrains.com/display/IDEADEV/Inotify+Watches+Limit
#
# More information resources:
# -$ man inotify # manpage
# -$ man sysctl.conf # manpage
# -$ cat /proc/sys/fs/inotify/max_user_watches # print current value in use
@xthiago
xthiago / gist:54e054540f8571ada9b5f1f853a7ab76
Created September 23, 2016 11:37 — forked from yano3/gist:1378948
git commit --amend --reset-author
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:
git config --global user.name "Your Name"
git config --global user.email you@example.com
After doing this, you may fix the identity used for this commit with:
git commit --amend --reset-author
@xthiago
xthiago / cache.php
Last active April 27, 2016 11:16
Drupal 7 - example with static and regular cache
<?php
function my_module_function() {
$my_data = &drupal_static(__FUNCTION__);
if (!empty($my_data)) {
return $my_data;
}
if ($cache = cache_get('my_module_data')) {
@xthiago
xthiago / README.md
Created April 24, 2016 02:09 — forked from chadrien/README.md
Debug PHP in Docker with PHPStorm and Xdebug

Debug your PHP in Docker with Intellij/PHPStorm and Xdebug

  1. For your local dev, create a Dockerfile that is based on your production image and simply install xdebug into it. Exemple:
FROM php:5

RUN yes | pecl install xdebug \
&amp;&amp; echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" &gt; /usr/local/etc/php/conf.d/xdebug.ini \
# inspired from http://nathanhoad.net/how-to-meld-for-git-diffs-in-ubuntu-hardy
# and http://gitguru.com/2009/02/22/integrating-git-with-a-visual-merge-tool/
sudo apt-get install meld
# create a python script with the below content and name it diff.py
#!/usr/bin/python
@xthiago
xthiago / InstanceofExtension.php
Last active August 29, 2015 14:15
Add support for instanceof in Twig
<?php
namespace Xthiago\CoreBundle\Twig;
class InstanceofExtension extends \Twig_Extension
{
/**
* {@inheritdoc}
*/
public function getTests()
@xthiago
xthiago / views.php
Last active August 29, 2015 14:15
Como formatar um número de modo que 1.000 = 1k e 1kk = 1.000.000
<?php
/*
* Esse snippet é uma resposta para dúvida a seguir. Pode ser melhorado
* de diversas formas (fazendo uso de recursão, por exemplo), mas o intuito é ser simples.
*
* Alguém ai on pra me da uma ajudinha com PHP?
* Tipo, em vários lugar da internet é possível visualizar formatações de números
* como "150k", "1kk", alguns devem saber que 150k corresponde a 150.000 e 1kk
* corresponder a 1.000.000... Gostaria então de saber como se faz isso na hora
* do "echo"!