Skip to content

Instantly share code, notes, and snippets.

@infn8
infn8 / parse_video_link.php
Created August 21, 2014 17:56
Parse youtube or vimeo URLs
@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 / 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 / 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 / .gitignore_global
Created July 10, 2014 21:21
Global gitignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@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";
<?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
#!/bin/sh
defaults write com.apple.finder CreateDesktop -bool false
killall Finder
osascript -e 'tell application "Terminal" to close (every window whose name contains ".command")' &
exit
@infn8
infn8 / image-category-snippet.php
Last active January 3, 2016 16:09
Add categories to your WordPress Images
<?php
// Begin Copy into functions.php
function image_category() {
$labels = array(
'name' => 'Image Categories',
'singular_name' => 'Image Category',
'menu_name' => 'Image Categories',
'all_items' => 'All Image Categories',
'parent_item' => 'Parent Image Category',
@infn8
infn8 / redirect.php
Last active December 29, 2015 16:19
301 Redirect template for wordpress
<?php
/*
Template Name: Redirect
*/
if(! empty($url = get_post_meta(get_the_id(), 'redirect', true))){
header("HTTP/1.1 301 Moved Permanently");
header("Location: ". $url);
die();
}
?>