Skip to content

Instantly share code, notes, and snippets.

View enniosousa's full-sized avatar

Ennio Sousa enniosousa

View GitHub Profile
@enniosousa
enniosousa / 1. Install Ubuntu Web Server.md
Last active January 6, 2020 13:36
Install LAMP (Linux Apache MySQL and PHP 7.3), Composer and SQL Server PHP PDO Driver

1. Instalação

Tutorial para Digital Ocean

2. Apache (Opcional)

Últil quando se tem apenas a porta 80 ou 443 liberada

Criar o virtual host com reverse proxy

Use o comando abaixo para criar o arquivo

@enniosousa
enniosousa / laravel-nearby-locations-query-scope.php
Created September 26, 2018 11:02 — forked from stevenmaguire/laravel-nearby-locations-query-scope.php
Laravel (Illuminate) query builder scope to list neighboring locations within a given distance from a given location
<?php
/**
* Query builder scope to list neighboring locations
* within a given distance from a given location
*
* @param Illuminate\Database\Query\Builder $query Query builder instance
* @param mixed $lat Lattitude of given location
* @param mixed $lng Longitude of given location
* @param integer $radius Optional distance
#EXTM3U
#EXTINF:-1 tvg-id="" tvg-name="Tomb Raider - A Origem" tvg-logo="https://i.imgur.com/AXaEFkh.jpg" group-title="MegaboxFilmes", Tomb Raider - A Origem
https://rc-v2.filmesonline.top/RedeCanais/RCFServer4/ondemand/TMBRDRORGM.mp4
#EXTINF:-1 tvg-id="" tvg-name="211 (LEG)" tvg-logo="https://goo.gl/RR1hef" group-title="2018", 211 (LEG)
http://tcdn22.micetop.us/httpdelivery/sex/antigos/nc/L/2112018LEG.mp4
#EXTINF:-1 tvg-id="" tvg-name="2036 Origem Desconhecida (LEG)" tvg-logo="https://goo.gl/KcDcQX" group-title="MegaboxFilmes", 2036 Origem Desconhecida (LEG)
http://tcdn22.micetop.us/httpdelivery/sex/antigos/nc/L/2036ORIGEMDESCONHECIDA2018LEG.mp4
@enniosousa
enniosousa / googlemap.html
Last active June 13, 2018 14:00 — forked from brittanydionigi/googlemap.html
pin cities on a google map based on city name & country
<!doctype>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Google Maps - pin cities</title>
<style type="text/css">
html, body { height: 100%; margin: 0; padding: 0; }
#map_canvas { height: 100%; }
</style>
@enniosousa
enniosousa / explode_with_escape.php
Created May 9, 2018 14:17
Explode string to array scaping literal char
<?php
//code from https://stackoverflow.com/a/38071156/4830771
function separate($string, $separator = '|', $escape = '\\') {
if (strlen($separator) != 1 || strlen($escape) != 1) {
trigger_error(__FUNCTION__ . ' requires delimiters to be single characters.', E_USER_WARNING);
return;
}
$segments = [];
$string = (string) $string;
do {
@enniosousa
enniosousa / strip_html_content.php
Last active May 9, 2018 13:43
Strip HTML tags, remove attributes and empty tags
<?php
/**
* Strip HTML tags, remove attributes and empty tags
*
* @param string $html — HTML string
* @param array $preserve_tags — HTML tags that you wnat preserve
* @param array $remove_attrs — HTML attributes that you want remove. You can use remove attributes that starts with
* @param bool $remove_empty_tags — remove empty tags, that is without content
* @return string
*/

Usando banco de dados SQLite e PHP do uCoz

Usando o PHP do uCoz algumas funções são limitadas, por exemplo, não tem banco de dados e não podemos usar o banco de dados em um servidor remoto já que não é possível fazer a conexão.

Pensando em uma solução para manter os dados organizados me ocorreu de usar SQLite.

Sugestão

Assim que eu soube que era possível usar SQLite fui em busca de uma classe PHP que me ajudasse, eu achei esta e gostei muito https://github.com/ennio21/SQLite

Código

uCoz: Ajax pagination at modules

This Javascript code modifies the function spages().

What it does
  • Ajax pagination (if it is enabled on the Common settings)
  • Scrolls the page to the top after clicking on the button
  • Change the URL in address bar to requested page, like Google Webmasters says.
  • Send pageview to Google Analytics (if you are using)