Skip to content

Instantly share code, notes, and snippets.

@bytefade
bytefade / wp-mail.php
Last active January 21, 2016 13:00
Simple mail wordpress for tests
<?php
// 3 - Se der erro me envia uma mensagem
$message = "Postagem atualizado no site:\n\n";
$message .= $post->post_title . ": " . $post_url . "\n\n";
$message .= "URL pequena: " . $short_url . " URL Expand" . $long_url . "\n\n";
$message .= "VAR_DUMP: " . var_dump($response);
if (!$response) {
$subject = 'ERRRO - Teste criar/atualizar post e API short url';
@bytefade
bytefade / ffmpeg.convert.mv.sh
Created January 8, 2016 19:09
ffmpeg convert and rename
#!/bin/bash
#
#RUN: find ../uploads/videos/ -iname "*.mp4" -exec ./ffmpeg.sh {} ";"
dir_atual=$(dirname $1)
filename=$(basename $1)
extension=${filename##*.}
filename=${filename%.*}
@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%.*}
@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 / 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 / .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 / 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

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 / 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);
@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