Skip to content

Instantly share code, notes, and snippets.

View hewerthomn's full-sized avatar
👨‍💻
Coding...

Éverton Inocêncio hewerthomn

👨‍💻
Coding...
View GitHub Profile
@hewerthomn
hewerthomn / install-oh-my-zsh.sh
Created January 26, 2017 11:30
Offline install of oh-my-zsh on Ubuntu
main() {
# Use colors, but only if connected to a terminal, and that terminal
# supports them.
if which tput >/dev/null 2>&1; then
ncolors=$(tput colors)
fi
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
RED="$(tput setaf 1)"
GREEN="$(tput setaf 2)"
YELLOW="$(tput setaf 3)"
@hewerthomn
hewerthomn / install_oci8_ubuntu_16.04_php7.1.md
Created February 22, 2017 14:45
How to install OCI8 on Ubuntu 16.04 and PHP 7.1
@hewerthomn
hewerthomn / Kernel.php
Created February 25, 2017 16:56
Como definir o locale pt_BR no Laravel 5.4
<?php
// app/Http/Kernel.php
/* ... */
protected $middleware = [
/* ... */
\App\Http\Middleware\LocaleSetup::class,
/* ... */
<?php
/**
* Calculate the mod11
* @param string $baseVal
* @param string $separator
* @return string
*/
public function mod11($baseVal = "", $separator = '-')
{
@hewerthomn
hewerthomn / install_postgresql9.3_postgis2.1_ubuntu.md
Last active October 19, 2020 09:02
Installing PostgreSQL 9.3 and PostGIS on Ubuntu 14.04

Remove old PostGIS Installation

The first step is to remove older version of PostGIS if any.

sudo apt-get purge postgis

Setup repository

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" >> /etc/apt/sources.list.d/postgresql.list'
@hewerthomn
hewerthomn / search.sql
Last active August 13, 2020 16:43
Search for a string across all table in Oracle
-- Source of inspiration of this snippet
-- https://www.experts-exchange.com/questions/27396707/Search-for-a-string-across-all-tables-in-oracle.html#a42581782
declare
num_rows number;
sql_text varchar2(2500);
sql_info varchar2(1000);
v_text varchar2(100) := '''%value_in_lowercase%''';
begin
dbms_output.enable(1000000);
@hewerthomn
hewerthomn / nginx_php7_ssl
Last active November 4, 2018 20:00
Simple nginx PHP7 SSL Configuration
server {
server_name DOMAIN;
listen 80;
listen [::]:80;
return 301 https://$server_name$request_uri;
}
server {
server_name DOMAIN;
@hewerthomn
hewerthomn / index.php
Created April 21, 2013 04:54
Página php que acessa API da wunderground e escreve a cidade, pais, umidade, temperatura e hora atual. Exemplo: <Porto Velho/RO|89% 23C|10:39>
<?php
/**
* API Index
*/
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: application/json');
$service = $_GET['s'];
date_default_timezone_set('America/Porto_Velho');
@include('envoy.config.php');
@servers($servers)
@setup
$startTime = microtime(true);
$startedAt = date('H:i:s');
if ( ! isset($repo) ) {
throw new Exception('Variável $repo não está definido!');
@hewerthomn
hewerthomn / Model.php
Created January 16, 2017 20:11
Laravel Eloquent selectList
<?php
/*...*/
public function selectList()
{
$list = $this->select('name', 'id')
->orderBy('name')
->pluck('name', 'id');