Skip to content

Instantly share code, notes, and snippets.

View xentek's full-sized avatar
🌩️
Conjuring Clouds

Eric Marden xentek

🌩️
Conjuring Clouds
View GitHub Profile
@xentek
xentek / upload-override.php
Created July 29, 2011 16:09
Override upload_path in WordPress
<?php
/*
Plugin Name: Upload Override
Plugin URI: http://xentek.net/
Description: Override the Upload Path so that it is always set the way you want
Version: 0.1
Author: Eric Marden
Author URI: http://xentek.net/
*/
@xentek
xentek / paginated_collection.js
Created August 18, 2011 19:22 — forked from io41/paginated_collection.js
Pagination with Backbone.js
// includes bindings for fetching/fetched
var PaginatedCollection = Backbone.Collection.extend({
baseUrl: '/items', // set this to your restful route on the server
initialize: function() {
_.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage');
typeof(options) != 'undefined' || (options = {});
this.page = 1;
typeof(this.perPage) != 'undefined' || (this.perPage = 10);
@xentek
xentek / xentek.zsh-theme
Created August 24, 2011 15:16
Sexy Prompt is Sexy
PROMPT='%{$fg[white]%}☁ %{$fg[green]%}%M%{$reset_color%}:%{$fg[blue]%}%~%b%{$reset_color%} $(git_time_since_commit) $(check_git_prompt_info)
%{$fg[yellow]%}⚡ %{$reset_color%}'
PS2='%{$fg[yellow]%}⚡ %{$reset_color%}'
RPROMPT='%{$fg[grey]%}⚡%{$reset_color%}'
RPS2='%{$fg[grey]%}⚡%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[white]%}[ %{$fg[yellow]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}]"
@xentek
xentek / Rakefile
Created September 23, 2011 05:14 — forked from ubermajestix/Rakefile
Rake tasks for managing your spork server. Check the Rakefile to bypass loading Rails to run these rake tasks super fast.
#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
# If certain tasks are called, don't load Rails!
if %w(spork:start spork:restart spork:stop).include?(Rake.application.top_level_tasks.first)
# Load the rake tasks
Dir.glob("#{File.expand_path("../lib/tasks", __FILE__)}/*.rake").each { |r| import r }
else
require File.expand_path('../config/application', __FILE__)
@xentek
xentek / generate_update.sh
Created November 19, 2011 21:34
Generate the necessary sql statements to move a WordPress site from one environment to another
#!/usr/bin/env bash
echo "@@@ @@@ @@@@@@@@ @@@ @@@ @@@@@@@ @@@@@@@@ @@@ @@@ "
echo "@@@ @@@ @@@@@@@@ @@@@ @@@ @@@@@@@ @@@@@@@@ @@@ @@@ "
echo "@@! !@@ @@! @@!@!@@@ @@! @@! @@! !@@ "
echo "!@! @!! !@! !@!!@!@! !@! !@! !@! @!! "
echo " !@@!@! @!!!:! @!@ !!@! @!! @!!!:! @!@@!@! "
echo " @!!! !!!!!: !@! !!! !!! !!!!!: !!@!!! "
echo " !: :!! !!: !!: !!! !!: !!: !!: :!! "
echo ":!: !:! :!: :!: !:! :!: :!: :!: !:! "
@xentek
xentek / httparty-xml-example.rb
Created February 7, 2012 01:57
HTTParty with XML example
require 'httparty'
response = HTTParty.get('http://www.google.com/ig/api?weather=Chicago')
data = response.parsed_response
puts data['xml_api_reply']['weather']['current_conditions']['condition']['data']
@xentek
xentek / wp-unit-tests.md
Created August 26, 2012 19:06
WordPress Unit Tests Quick Start

WordPress Unit Tests Quick Start Guide

This quick start guide is geared towards installing PHPUnit on OSX in order to run the WordPress unit tests. It uses homebrew to install PHP using homebrew-php. You can likely skip this step if you've already got php and pear installed properly.

If you use MAMP, then try these instructions to use MAMP's php and pear to install PHPUnit.

install homebrew

ruby &lt;(curl -fsSkL raw.github.com/mxcl/homebrew/go)
@xentek
xentek / du_sorted.sh
Created August 27, 2012 16:50
Disk Usage (du), sorted by human readable size
!# /usr/bin/env sh
du -s ./* | sort -n| cut -f 2-| xargs du -sh {}
@xentek
xentek / gitconfig.md
Created September 12, 2012 20:12
my current ~/.gitconfig
[alias]
	ci = commit
	co = checkout
	st = status
	info = status
	svn-diff = !git-svn-diff
	l = log --graph --pretty=format':%C(yellow)%h%Cblue%d%Creset %s %C(white) %an, %ar%Creset'
	lol = log --pretty=oneline --abbrev-commit --graph --decorate
	unstage = reset HEAD
@xentek
xentek / gist:4108719
Created November 19, 2012 02:57
Subversion bash aliases
# SVN
# set your editor
export SVN_EDITOR="/usr/bin/vi"
# add everything that needs to be added based on results of svn status
alias svnadd="svn st | grep \? | awk '''{print \"svn add \"$2 }''' | bash"
# show svn status, sans the noise from externals
alias svnst='svn st --ignore-externals'