Skip to content

Instantly share code, notes, and snippets.

@matthewsimo
matthewsimo / show
Last active September 26, 2015 03:58
Little bash script that toggles showing hidden files in Finder - add to your .bashrc file.
#! /bin/bash
# show/hide .files
function show {
showfiles=`defaults read com.apple.Finder AppleShowAllFiles`
if [ "$showfiles" = "TRUE" ]; then
echo "Files Hidden";
defaults write com.apple.finder AppleShowAllFiles FALSE
else
echo "Showing Hidden Files";
@matthewsimo
matthewsimo / gist:1849255
Created February 17, 2012 00:44
Add to the bottom of "/Contents/Resources/completions.json" for sass tab-completion (just before the closing '}'!) in Chocolat App
,
"sass": [
{
"snippet": "$$: %{0};",
"confident": "yes",
"items": [
"alignment-adjust",
"alignment-baseline",
"animation",
"animation-delay",
@matthewsimo
matthewsimo / webperformant.htaccess
Created February 23, 2012 11:39 — forked from davatron5000/webperformant.htaccess
An .htaccess file for web performance and passing Page Speed and YSlow rules
# Enable GZIP
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</ifmodule>
# Expires Headers - 2678400s = 31 days
<ifmodule mod_expires.c>
@matthewsimo
matthewsimo / gist:1959512
Created March 2, 2012 16:34
Copy a DB to new place
sudo mysqldump -u username -p****** DBNAME | ssh remoteUser@remote.domain.url "mysql -u username -p****** DBNAME"
@matthewsimo
matthewsimo / local-config.php
Created May 11, 2012 16:37
Local Config for WP
<?php
define('WP_CONTENT_DIR','/Users/matthewsimo/projects/lift/.../wp-content');
define('WP_CONTENT_URL','http://local.project.com/wp-content');
define('WP_SITEURL','http://local.project.com/');
define('WP_HOME','http://local.project.com/');
@matthewsimo
matthewsimo / wp_full_page_modification.php
Created July 13, 2012 18:02 — forked from supercleanse/wp_full_page_modification.php
Full page modification in WordPress
<?php
add_action('init', 'fpm_start_output');
add_action('shutdown', 'fpm_end_output');
function fpm_start_output() {
ob_start('fpm_mod_buffer');
}
function fpm_mod_buffer($buffer) {
// Modification ... regexp, etc
@matthewsimo
matthewsimo / gist:3422501
Created August 22, 2012 05:28
SQL Query to find 'search-term-find' & replace with 'search-term-replace' in a colX in tableX if colY matches colYvalue in same row.
UPDATE tableX
SET tableX.`colX` = REPLACE(colX,'search-term-find','search-term-replace')
WHERE tableX.`colY` = 'colYvalue';
@matthewsimo
matthewsimo / some.sh
Created October 11, 2012 18:54 — forked from tj/some.sh
change terminal tab name on cd
function tabname {
printf "\e]1;$1\a"
}
if [ x`type -t cd` == "xfunction" ]; then
# previously wrapped cd
eval $(type cd | grep -v 'cd is a function' | sed 's/^cd/original_cd/' | sed 's/^}/;}/' )
else
# builtin
eval "original_cd() { builtin cd \$*; }"
@matthewsimo
matthewsimo / insults.coffee
Created November 29, 2012 19:18
Insults script for hubot
# Allow Hubot to give a burn Shakespeare would approve of.
#
# Commands:
# insult <name> - Don't have a good comeback, ask for some backup.(name parameter optional)
data = [["artless","bawdy","beslubbering","bootless","churlish","cockered","clouted","craven","currish","dankish","dissembling","droning","errant","fawning","fobbing","froward","frothy","gleeking","goatish","gorbellied","impertinent","infectious","jarring","loggerheaded","lumpish","mammering","mangled","mewling","paunchy","pribbling","puking","puny","qualling","rank","reeky","roguish","ruttish","saucy","spleeny","spongy","surly","tottering","unmuzzled","vain","venomed","villainous","warped","wayward","weedy","yeasty","cullionly","fusty","caluminous","wimpled","burly-boned","misbegotten","odiferous","poisonous","fishified"],["tardy-gaited","rampallian","beef-witted","dizzy-eyed","fool-born","scurvy-valiant","brazen-faced","muddy-mettled","beetle-headed","boil-brained","clapper-clawed","folly-fallen","base-court","full-gorged","flap-mouthed","mot
@matthewsimo
matthewsimo / SQL-Query-WP-Plugin-boilerplate.php
Created December 28, 2012 23:12
Boilerplate code for a plugin with the purpose of a SQL query.
<?php
/*
Plugin Name: Fix Such and Such Problem
Description: This plugin fixes such and such because such and such is broken
Version: 0.1
Author: Awesome Plugin Meister
*/
if(!class_exists('Such_Such_Fixer')){
class Such_Such_Fixer{