Skip to content

Instantly share code, notes, and snippets.

<?php
// Get Base URI
$baseUri = str_replace($_SERVER['DOCUMENT_ROOT'], '', dirname($_SERVER['SCRIPT_FILENAME']));
$http = str_replace(array('/', '\\'), '/', $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'] . $baseUri . '/');
$catalog = explode('/', $http);
array_pop($catalog);
array_pop($catalog);
$catalog = implode('/', $catalog) . '/';
@bytefade
bytefade / random.js
Created December 21, 2016 19:40 — forked from luanrm/random.js
var cores = [
"#F44336",
"#E91E63",
"#9C27B0",
"#673AB7",
"#3F51B5",
"#2196F3",
"#03A9F4",
"#00BCD4",
"#009688",
@bytefade
bytefade / index.html
Last active December 22, 2016 00:16 — forked from luanrm/index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<p class="esg-click-to-play-video">Teste</p>
<p class="esg-click-to-play-video">Teste</p>
@bytefade
bytefade / 0_reuse_code.js
Created February 12, 2016 11:02
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@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/
<?php
# Load slim WP
define( 'WP_USE_THEMES', false );
require( './wp-load.php' );
# http://phpexcel.codeplex.com/
require_once dirname(__FILE__) . '/Classes/PHPExcel.php';
global $wpdb;
$query = "SELECT * FROM $wpdb->comments
#!/bin/sh
# Sublime Text 3 install with Package Control (last update: 4 April 2015)
#
# No need to download this script, just run it on your terminal:
#
# $ curl -L git.io/sublimetext | sh
#
# When you need to update Sublime Text, run this script again.
# Local Dates:
git log --date=local --pretty=format:"%h%x09%an%x09%ad%x09%s" > commits.local.tsv.txt
# ISO Dates:
git log --date=iso --pretty=format:"%h%x09%an%x09%ad%x09%s" > commits.iso.tsv.txt
<?php # -*- coding: utf-8 -*-
// function remove_accents()
/**
* Unaccent the input string string. An example string like `ÀØėÿᾜὨζὅБю`
* will be translated to `AOeyIOzoBY`. More complete than :
* strtr( (string)$str,
* "ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ",
* "aaaaaaaaaaaaooooooooooooeeeeeeeecciiiiiiiiuuuuuuuuynn" );
*