Skip to content

Instantly share code, notes, and snippets.

<?php
/*
Copyright (c) 2012 Twilio, Inc.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
@infn8
infn8 / fn_var_pre.php
Last active August 29, 2015 14:02
Var Dump Helper Function and sublime caller snippet
<?php
function var_pre($var, $msg = NULL){
/*
Helper Function:
Use *instead of* var_dump();
will output var_dump wrapped with <pre></pre> and give an optional 2nd param for a message.
*/
echo "\n<pre>";
if($msg !== NULL){
echo "\n".$msg."\n";
@infn8
infn8 / .gitignore_global
Created July 10, 2014 21:21
Global gitignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@infn8
infn8 / Wp Permissions.txt
Last active August 29, 2015 14:04
Set WP permissions on Dreamhost via SSH
cd /path/to/wordpress/install/
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
find . -name "wp-config.php" -exec chmod 640 {} \;
@infn8
infn8 / output_comment.php
Created July 22, 2014 19:23
Toss this in all your WordPress template files to add a source code comment that helps you track down what file is generating your page.
<!-- Generating Template: <?php echo basename(__FILE__, '.php'); ?>.php -->
@infn8
infn8 / .bash_profile
Created August 7, 2014 13:42
Bash Profile Aliases
#!/bin/bash
#
#
# Aliases
#
alias ll="ls -la"
alias sw="sass --watch --debug-info sass:css"
alias swp="sass --watch --style compressed sass:css"
@infn8
infn8 / parse_video_link.php
Created August 21, 2014 17:56
Parse youtube or vimeo URLs
@infn8
infn8 / Modernizr.canvasblending.js
Last active August 29, 2015 14:06
Modernizer Canvas Blend Modes
Modernizr.addTest('canvasblending', function() {
if (Modernizr.canvas === false) return false;
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
ctx.globalCompositeOperation = 'screen';
return ctx.globalCompositeOperation === 'screen';
});
@infn8
infn8 / clearAllTimers.js
Created September 10, 2014 19:48
Clear All JS Timers
tempID = window.setTimeout(function() {}, 0);
while (tempID--) {
window.clearTimeout(tempID); // will do nothing if no timeout with tempID is present
}
tempID = window.setInterval(function() {}, 0);
while (tempID--) {
window.clearInterval(tempID); // will do nothing if no interval with tempID is present
}
@infn8
infn8 / Default (OSX).sublime-keymap
Created October 5, 2014 04:08
Sublime Text Bootstrap Shortcuts and Snippets
[
{ "keys": ["super+shift+alt+b", "super+shift+alt+o", "super+shift+alt+x"], "command": "insert_snippet", "args": {"name": "Packages/User/bcxo.sublime-snippet"}},
{ "keys": ["super+shift+alt+b", "super+shift+alt+x"], "command": "insert_snippet", "args": {"name": "Packages/User/bcx.sublime-snippet"}},
{ "keys": ["super+shift+alt+b", "super+shift+alt+o", "super+shift+alt+s"], "command": "insert_snippet", "args": {"name": "Packages/User/bcso.sublime-snippet"}},
{ "keys": ["super+shift+alt+b", "super+shift+alt+s"], "command": "insert_snippet", "args": {"name": "Packages/User/bcs.sublime-snippet"}},
{ "keys": ["super+shift+alt+b", "super+shift+alt+o", "super+shift+alt+m"], "command": "insert_snippet", "args": {"name": "Packages/User/bcmo.sublime-snippet"}},
{ "keys": ["super+shift+alt+b", "super+shift+alt+m"], "command": "insert_snippet", "args": {"name": "Packages/User/bcm.sublime-snippet"}},
{ "keys": ["super+shift+alt+b", "super+shift+alt+o", "super+shift+alt+l"], "command": "insert_snippet", "args": {"n