Skip to content

Instantly share code, notes, and snippets.

@jgwhite
jgwhite / EXAMPLE.md
Created June 15, 2011 14:37
Jump-to-project command line tool

Type p proj to jump to ~/Sites/my_project

Type p js to bring up a list of projects whose names contain 'js'

@jgwhite
jgwhite / string_asciify.rb
Created August 23, 2011 15:16
A much smarter replacement for my old String#unaccent method. Credit goes to @GrahamAshton.
class String
def asciify
self.mb_chars.normalize(:kd).to_s
end
alias_method :unaccent, :asciify
alias_method :remove_diacritics, :asciify
end
@jgwhite
jgwhite / functions.php
Created November 20, 2011 16:29
WP Argghhhh
<?php
function get_current_depth() {
global $wp_query;
$object = $wp_query->get_queried_object();
$parent_id = $object->post_parent;
$depth = 0;
while ($parent_id > 0) {
$page = get_page($parent_id);
$parent_id = $page->post_parent;
@jgwhite
jgwhite / splashy.js
Created November 23, 2011 16:47
Splash Page Logic
(function() {
function isHome() {
return window.location.pathname === '/';
}
function isSplash() {
return window.location.pathname === '/splash';
}
@jgwhite
jgwhite / gist:1438301
Created December 6, 2011 14:00
Sequel Pro WPURL Snippet
UPDATE wp_options SET option_value = REPLACE(`option_value`, '${1:}', '${2:}');
UPDATE wp_posts SET post_content = REPLACE(`post_content`, '$1', '$2');
UPDATE wp_posts SET guid = REPLACE(`guid`, '$1', '$2');
@jgwhite
jgwhite / slideshow.rb
Created January 19, 2012 13:08
How slice templates will look
class Slideshow < Slice
has_attachments :slides, :class_name => "Slide"
end
class Slide < Attachment
field :caption
field :link
end
@jgwhite
jgwhite / USAGE.md
Created January 31, 2012 09:20
Jamie’s Quick iA3 Active-state Patch

Place the file above (ia3.patch) in the theme’s directory and run:

$ patch < ia3.patch

@jgwhite
jgwhite / rikify.html
Created February 10, 2012 18:23
Rikify
<!doctype html>
<html>
<head>
<title>Rikify</title>
<style type="text/css">
#button {
font-family: Lucida Grande;
font-size: 11px;
text-decoration: none;
font-weight: bold;
RewriteEngine on
RewriteCond %{HTTP_HOST} =some.domain.com
RewriteRule ^(.*)$ http://other.domain.com$1
echo 'na'