Skip to content

Instantly share code, notes, and snippets.

View michaelaguiar's full-sized avatar
🎯
Focusing

Michael Aguiar michaelaguiar

🎯
Focusing
View GitHub Profile
@michaelaguiar
michaelaguiar / wp_permissions.sh
Created February 12, 2014 21:34
Fix Wordpress Permissions
find ~/public_html -type d -exec chmod 755 {} \;
find ~/public_html -type f -exec chmod 644 {} \;
@michaelaguiar
michaelaguiar / cookie.js
Last active August 29, 2015 13:56
Manage Cookies with JS
@michaelaguiar
michaelaguiar / coordinates.php
Created May 5, 2014 21:06
XLSX Parse and coordinate retrieval via Bing Maps API
<?php
require_once('simplexlsx.class.php');
$xlsx = new SimpleXLSX('test.xlsx', false, true);
$locations = array();
foreach ($xlsx->rows(3) as $row) {
if ($row[6]) {
$locations[] = array(
'address' => str_replace('.', '', str_replace('#', '', $row[6])),
@michaelaguiar
michaelaguiar / shellshock.sh
Created September 25, 2014 17:12
Test for "ShellShock" bash vulnerability on Linux
env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
<?php
/**
* WooCommerce Extra Feature
* --------------------------
*
* Add custom fee to cart automatically
*
*/
function woo_add_cart_fee()
{
@michaelaguiar
michaelaguiar / price.css
Created May 28, 2015 17:56
100% CSS Price Tag
.price {color:#fff; position:absolute; right:0; top:10px; height:48px; line-height:48px; padding:0 20px;}
.price:after {position:absolute; content:""; left:-12px; width:0px; height:0px; border-top:24px solid black; border-bottom:24px solid black; border-left:12px solid transparent;}
.price.red {background:#e1559a;}
.price.red:after {border-top-color:#e1559a; border-bottom-color:#e1559a;}
.price.blue {background:#329af2;}
.price.blue:after {border-top-color:#329af2; border-bottom-color:#329af2;}
.price.green {background:#a8d688;}
@michaelaguiar
michaelaguiar / site.conf
Created September 16, 2015 19:12
NGINX Browser Caching
##
# Caching
##
# Expire rules for static content
location ~* \.(?:manifest|appcache|html?|xml|json)$ {
expires -1;
# access_log logs/static.log; # I don't usually include a static log
}
@michaelaguiar
michaelaguiar / ajax.js
Created August 31, 2011 18:51
JQuery AJAX Request
var data = $(this).serialize();
$.ajax({
type: 'POST',
url: 'URLHERE',
data: data,
success: function(response) {
$('#result').html(response);
},
complete: function() {
// Complete
@michaelaguiar
michaelaguiar / hide_hidden.sh
Created September 29, 2011 00:28
Hide Hidden Files on Mac OS X
defaults write com.apple.finder AppleShowAllFiles FALSE
killall Finder
@michaelaguiar
michaelaguiar / show_hidden.sh
Created September 29, 2011 00:28
Show Hidden Files on Mac OS X
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder