Skip to content

Instantly share code, notes, and snippets.

View williameliel's full-sized avatar
💭
annoying-a

William Garcia williameliel

💭
annoying-a
View GitHub Profile
#!/bin/bash
if [ -z $1 ]
then
echo "Enter commit message"
exit 1;
fi
middleman build
git add -A
git commit -am "$1"
git push
FastCGI caching directives
fastcgi_cache_path /etc/nginx/cache levels=1:2 keys_zone=WORDPRESS:30m inactive=30m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_lock on;
fastcgi_cache_use_stale error timeout invalid_header http_500;
fastcgi_cache_valid 5m;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
server {
##DM - uncomment following line for domain mapping
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div id="tweet"></div>
@williameliel
williameliel / gist:cb612466711203280332
Created June 1, 2015 16:45
Purge Varnish on Save
function varnish_purge($post_id)
{
$hostname = 'localhost';
$port = 80;
$URL = get_permalink( $post_id );
$debug = false;
// $finalURL = sprintf(
// "http://%s:%d%s", $hostname, $port, $URL
// );
@williameliel
williameliel / gist:e2e7d051cb5a2663b814
Created May 26, 2015 14:29
Restore MySQL - Ubuntu
#!/bin/bash
if [[ ! "$(/usr/sbin/service mysql status)" =~ "start/running" ]]
then
/usr/sbin/service mysql start
fi
@williameliel
williameliel / remove emojis
Created June 12, 2014 15:16
Remove Emojis from Instagram/Twitter/Facebook API responses
function remove_emoji($text) {
$clean_text = "";
// Match Emoticons
$regexEmoticons = '/[\x{1F600}-\x{1F64F}]/u';
$clean_text = preg_replace($regexEmoticons, '', $text);
// Match Miscellaneous Symbols and Pictographs
$regexSymbols = '/[\x{1F300}-\x{1F5FF}]/u';