Skip to content

Instantly share code, notes, and snippets.

@kneipp
kneipp / .htaccess
Created May 8, 2015 02:21
htaccess removing php extension keeping query string
# http://stackoverflow.com/questions/19050516/combine-htaccess-rules-remove-extension-and-rewrite-url-variables?rq=1
Options +FollowSymLinks -Indexes -MultiViews
RewriteEngine On
RewriteBase /subdirectory
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/$ $1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
@kneipp
kneipp / gist:431094e9a8f8fb9a2054
Created February 7, 2015 16:32
php_codesniffer osx
pear uninstall PHP_CodeSniffer
pear config-set php_bin change/path/to
pear config-set bin_dir change/path/to
pear install PHP_CodeSniffer
@kneipp
kneipp / gist:288abd866b593f9592f0
Created September 12, 2014 19:52
httpd.conf - htaccess settings
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/Library/WebServer/Documents">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
@kneipp
kneipp / gist:ee44c864d44f3e5258e9
Created September 8, 2014 13:40
403 Forbidden after install PHP56 and Apache OSX Ubuntu
Checklist:
- Check if your user exists in: /private/etc/apache2/users
- Check if your path is correct inside conf file:
<Directory "/Users/username/Projects">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
@kneipp
kneipp / gist:de9c0876242fc0ff849c
Created September 7, 2014 23:30
ao instalar o mysql
mysql_secure_installation
@kneipp
kneipp / gist:525043c627f433cb1f9e
Created August 28, 2014 13:21
adding custom style to wp-admin wordpress
<?php
//http://wordpress.stackexchange.com/questions/110895/adding-custom-stylesheet-to-wp-admin
//from functions.php
//First solution : one file
add_action( 'admin_enqueue_scripts', 'load_admin_style' );
function load_admin_style() {
wp_register_style( 'admin_css', get_template_directory_uri() . '/admin-style.css', false, '1.0.0' );
//OR
wp_enqueue_style( 'admin_css', get_template_directory_uri() . '/admin-style.css', false, '1.0.0' );
@kneipp
kneipp / gist:bc4572da37b66831712f
Created August 23, 2014 03:33
laravel under construction accessed by url or date to launch
//em construcao
date_default_timezone_set("America/Sao_Paulo");
if (Session::has('access') or (time() > mktime(0, 0, 1, 8, 23, 2014))) {
Route::get('/', 'HomeController@index');
} else {
Route::get('/', function () {
return View::make('underConstruction');
});
}
Route::get('/your-url-here', function () {
@kneipp
kneipp / gist:9293199
Created March 1, 2014 17:09
remover arquivo de forma recursiva
$ find . -type f -name '*.DS_Store' -ls -delete # Remover arquivos .DS_Store de forma recursiva (mac users). #unixtip
@kneipp
kneipp / gist:9238613
Created February 26, 2014 21:09
Adicionando blank via jquery
$( document ).ready(function() {
$("a").attr("target","_blank");
});
@kneipp
kneipp / gist:6599324
Created September 17, 2013 19:18
brew install ....
-without-homebrew-php