Skip to content

Instantly share code, notes, and snippets.

@bytefade
bytefade / getBrowser.php
Created July 29, 2015 00:35
get browser and Other...
<?php
function getBrowser()
{
$u_agent = $_SERVER['HTTP_USER_AGENT'];
$bname = 'Unknown';
$platform = 'Unknown';
$version= "";
//First get the platform?
@bytefade
bytefade / info.php
Created July 29, 2015 01:31
Info User
<?php
$msg .= "---Informações de usuários--- \n"."<br>"; //Título
$msg .= "Data/hora : ".date('d/m/Y H:i:s')."\n"."<br>"; //IP do remetente
$msg .= "IP do usuário : ".$_SERVER["REMOTE_ADDR"]."\n"."<br>"; //IP do remetente
$msg .= "userAgent : ".$browser['userAgent']."\n"."<br>"; //User Agent
$msg .= "name : ".$browser['name']."\n"."<br>"; //User Agent
$msg .= "version : ".$browser['version']."\n"."<br>"; //User Agent
$msg .= "platform : ".$browser['platform']."\n"."<br>"; //User Agent
$msg .= "pattern : ".$browser['pattern']."\n"."<br>"; //User Agent
$msg .= "Envio apartir de : ".$_SERVER["HTTP_REFERER"]."<br>"; //Referências
@bytefade
bytefade / size.sql
Created August 1, 2015 01:39
Descobrir qual o tamanho das tabelas do seu banco de dados. Dica do artigo: https://www.flynsarmy.com/2013/03/get-mysql-table-sizes/
SELECT TABLE_NAME AS "Table",
round(((data_length + index_length) / 1024 / 1024), 2) AS Size_in_MB
FROM information_schema.TABLES
WHERE table_schema = 'my_db_name'
ORDER BY Size_in_MB DESC
@bytefade
bytefade / location.object.js
Created September 1, 2015 19:00
location.object.js
console.log(
'hash' + location.hash + ' === '
+ 'host' + location.host + ' === '
+ 'hostname' + location.hostname + ' === '
+ 'href' + location.href + ' === '
+ 'origin' + location.origin + ' === '
+ 'pathname' + location.pathname + ' === '
+ 'port' + location.port + ' === '
+ 'protocol' + location.protocol + ' === '
+ 'search' + location.search);

find /var/www/PATH/OF/FILE_or_DIR/ -type f -exec chmod -R 644 {} ;

find /var/www/PATH/OF/FILE_or_DIR/ -type d -exec chmod -R 755 {} ;

PERMISSOES WORDPRESS chmod -R 755 wp-content

chmod -R 755 wp-admin

chmod -R 755 wp-includes

@bytefade
bytefade / virtualhostbasic.conf
Created September 16, 2015 13:50
virtualhost, mod rewrite e wordpress
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName domain.dev
ServerAlias www.domain.dev
DocumentRoot /var/www/path/of/domain
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/path/of/domain>
Options FollowSymLinks
AllowOverride All
@bytefade
bytefade / .htaccess
Created December 18, 2015 19:54 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@bytefade
bytefade / 1_passo.md
Created January 3, 2016 16:52 — forked from 3runoDesign/Procfile
Deploy Heroku [Laravel 5.1]

#Deploy Heroku - Laravel 5.1 Tive alguns problemas ao tentar fazer o deploy ao Heroku, para mais detalhes vejam esse post Deployment broken when upgrading to Laravel 5.1.

Criando projeto Laravel

Caso você esteja criando um projeto do zero utilize via Laravel Installer:

laravel new nome_app
@bytefade
bytefade / geocodeService.php
Last active January 4, 2016 18:32
Geocode Service via CURL
<?php
if (!function_exists('geocodeService')) {
function geocodeService($endereco)
{
$endereco = str_replace (" ", "+", urlencode($endereco));
$details_url = "http://maps.googleapis.com/maps/api/geocode/json?address=".$endereco;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $details_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
@bytefade
bytefade / ffmpeg.convert.sh
Last active January 8, 2016 18:17
Convert all video from directory with FFMPEG
#!/bin/bash
#
#RUN: find ../uploads/videos/ -iname "*.mp4" -exec ./ffmpeg.sh {} ";"
dir_atual=$(dirname $1)
filename=$(basename $1)
extension=${filename##*.}
filename=${filename%.*}