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 / 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);
<?php
/**
* Calculate the mod11
* @param string $baseVal
* @param string $separator
* @return string
*/
public function mod11($baseVal = "", $separator = '-')
{
@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,
/* ... */
@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
@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 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 / 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');
@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 / offers.php
Created February 21, 2016 13:58
Filter places by coordinates radius
<?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();
$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();