Skip to content

Instantly share code, notes, and snippets.

Éverton Inocêncio hewerthomn

Block or report user

Report or block hewerthomn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View mod11.php
<?php
/**
* Calculate the mod11
* @param string $baseVal
* @param string $separator
* @return string
*/
public function mod11($baseVal = "", $separator = '-')
{
@hewerthomn
hewerthomn / Kernel.php
Created Feb 25, 2017
Como definir o locale pt_BR no Laravel 5.4
View Kernel.php
<?php
// app/Http/Kernel.php
/* ... */
protected $middleware = [
/* ... */
\App\Http\Middleware\LocaleSetup::class,
/* ... */
@hewerthomn
hewerthomn / install_oci8_ubuntu_16.04_php7.1.md
Created Feb 22, 2017
How to install OCI8 on Ubuntu 16.04 and PHP 7.1
View install_oci8_ubuntu_16.04_php7.1.md
View envoy.php
@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 / install-oh-my-zsh.sh
Created Jan 26, 2017
Offline install of oh-my-zsh on Ubuntu
View install-oh-my-zsh.sh
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 / Model.php
Created Jan 16, 2017
Laravel Eloquent selectList
View Model.php
<?php
/*...*/
public function selectList()
{
$list = $this->select('name', 'id')
->orderBy('name')
->pluck('name', 'id');
@hewerthomn
hewerthomn / nginx_php7_ssl
Last active Nov 4, 2018
Simple nginx PHP7 SSL Configuration
View nginx_php7_ssl
server {
server_name DOMAIN;
listen 80;
listen [::]:80;
return 301 https://$server_name$request_uri;
}
server {
server_name DOMAIN;
@hewerthomn
hewerthomn / offers.php
Created Feb 21, 2016
Filter places by coordinates radius
View offers.php
<?php
$latlng = "-8.769926868691913 -63.88429307573199";
$radius = 5000;
$places = Place::where(DB::raw("ST_Distance_Sphere(places.latlng, ST_GeometryFromText('SRID=4326;POINT({latlng})'))"), '<', $radius)
->select('offers.*', DB::raw("ST_Distance_Sphere(places.latlng, ST_GeometryFromText('SRID=4326;POINT({$latlng})')) AS distance"))
->get();
View offers.php
$latlng = "-8.769926868691913 -63.88429307573199";
$radius = 5000;
$places = Place::where(DB::raw("ST_Distance_Sphere(places.latlng, ST_GeometryFromText('SRID=4326;POINT({latlng})'))"), '<', $radius)
->select('offers.*', DB::raw("ST_Distance_Sphere(places.latlng, ST_GeometryFromText('SRID=4326;POINT({$latlng})')) AS distance"))
->get();
@hewerthomn
hewerthomn / install_postgresql9.3_postgis2.1_ubuntu.md
Last active Feb 7, 2018
Installing PostgreSQL 9.3 and PostGIS on Ubuntu 14.04
View install_postgresql9.3_postgis2.1_ubuntu.md

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'
You can’t perform that action at this time.