SXSW 2012
Here is the list of bands that I saw during SXSW 2012.
Monday
Delta Spirit
Tuesday
Heart and Dagger
High on Fire
Wednesday
Mynameisjohnmichael
River City Extension
Typhoon
Wandas
Radiation City
Widowspeak
Koralleven
Dent May
Youth Lagoon
Natural Child
Turbo Fruits
Bleached
Pujol
Thursday
Of Monsters and Men
Love Inks
Glen Hasnard
Half Moon Run
We are Serenades
Cymbals Eat Guitars
Hospitality
Ringo Death Starr
Koralleven
Arms
Brazos
Gardens and Villa
Bear in Heaven
War on Drugs
Built to Spill
Friday
Spoek Mathambo
Escort
Chairlift
Heiroglyphics (non performance)
Kimbra
Tashaki Miyaki
Chad Valley
Django Django
Kindness
Big deal
Howler
2:54
Dinosaur Jr.
Saturday
Fidlar
Juan Cireol
Blouse
Sbtrkt
Big Sleep
Gauntlet Hair
Riverboat Gamblers
Valiant Thorr
Lovely Bad Things
The Evaporators
Parlovr
OFF!
Pennywise
Add Excerpt to page in WordPress
add_post_type_support( 'page', 'excerpt' );
Copy and paste the code above into your functions.php file. Yep, that’s it, that’s all it takes.
Published on March 7, 2012URL encoding for Facebook page tabs and canvas pages
It is important to URLencode your canvas and page tab URLs so as to not receive Facebook API 191 error messages.
For example in creating Facebook page tabs:
https://www.facebook.com/dialog/pagetab?app_id=YOUR_APP_ID&next=https%3a%2f%2fYOUR_APP_URL.com%2f
Otherwise you’ll keep getting this error message:
“API Error Code: 191 API Error Description: The specified URL is not owned by the application Error Message: Invalid redirect_uri: Given URL is not allowed by the Application configuration.”
evil.css
This is funny, seriously funny.
/* rotate the entire page 180 degrees.
the rule that started it all.
disabled by default because it's not very, um, subtle */
/*body {
-webkit-transform: rotate(180deg) !important;
-o-transform: rotate(180deg) !important;
-moz-transform: rotate(180deg) !important;
}*/
/* rotate *some* images 180 degrees */
img[src*="7"] {
-webkit-transform: rotate(180deg) !important;
-o-transform: rotate(180deg) !important;
-moz-transform: rotate(180deg) !important;
}
/* hide every first paragraph and list item */
p:first-child, li:first-child {
display: none !important;
}
/* Slightly smaller first letters */
*:first-letter {
font-size: 90% !important;
}
/* make everything sliiiightly blurry and foggy */
* {
text-shadow: 0 0 0.5em rgba(0, 0, 0, 0.5);
opacity: 0.98;
}
/* blurry IE */
body {
filter: progid:DXImageTransform.Microsoft.blur(pixelradius=1, enabled='true') !important;
}
@-webkit-keyframes fade {
0% { opacity: 0.98; }
100% { opacity: 0.49; }
}
/* Oh were you reading that? */
p {
-webkit-animation: fade 500s;
}
/* bring back <blink>! */
@-webkit-keyframes blink {
0% { opacity: 1.0; }
50% { opacity: 1.0; }
51% { opacity: 0.0; }
100% { opacity: 0.0; }
}
/* apply <blink> to H1s */
h1 {
-webkit-animation: blink 1s infinite;
}
/* always show scroll bars */
html {
overflow: scroll !important;
height: 100.1% !important;
width: 100.1% !important;
}
/* confusing/conflicting double vertical scrollbars */
body {
overflow: scroll !important;
height: 200% !important;
}
/* never allow selection! */
* {
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
}
Thank you web devs with more time on your hands/less sleep requirements than I have.
Published on January 3, 2012WordPress custom queries need resetting, y’hear?
So, as I often do when building WP themes, I make custom queries. Something along the lines of:
$custom_query = new WP_Query('category_name=category_name&showposts=3');
while ($custom_query->have_posts()) : $custom_query->the_post();
// Do fancy layout here
endwhile;
if(is_page())
// Do page stuff - DOESN'T WORK!!!
This is all well and good, but if you are using conditionals below this custom query, as we are in the example above, they will not work. At all. So, WordPress devs knew we’d need a construct for this. If you haven’t met, let me introduce you to wp_reset_query(). Add it after you close your loop and you’re all set to is_page(), is_archive(), etc.
$custom_query = new WP_Query('category_name=category_name&showposts=3');
while ($custom_query->have_posts()) : $custom_query->the_post();
// Do fancy layout here
endwhile;
wp_reset_query();
// Do conditionals ...
if (is_page())
// Do page stuff - Totally works!
Published on November 18, 2011
Add tweets to WordPress
I’m posting this here for future reference as I’ve had use of it in the past.
<?php
// Include to use built-in SimplePie functionality
// see: http://simplepie.org/wiki/reference/start for usage
include_once(ABSPATH . WPINC . '/feed.php');
add_filter( 'wp_feed_cache_transient_lifetime', create_function( '$a', 'return 3600;' ) );
// Set feed URL
$rss = fetch_feed('https://twitter.com/statuses/user_timeline/YOUR_TWITTER_ID.rss');
// Checks that the object is created correctly
if (!is_wp_error( $rss ) ) :
$maxitems = $rss->get_item_quantity(3);
// Build an array of all the items, starting with element 0 (first element).
$rss_items = $rss->get_items(0, $maxitems);
endif;
?>
<ul id="tweetbox">
<?php
if ($maxitems == 0) {
echo '<li>Twitter unavailable at this time.';
} else {
foreach ( $rss_items as $item ) :
//Fetch the tweet itself
$xtwit = $item->get_description();
//Remove the preceding 'username: '
$xtwit = substr(strstr($xtwit, ': '), 2, strlen($xtwit));
// Convert URLs into hyperlinks
$xtwit = preg_replace("/(http:\/\/)(.*?)\/([\w\.\/\&\=\?\-\,\:\;\#\_\~\%\+]*)/", "<a href=\"\\0\" rel=\"external\">\\0</a>", $xtwit);
// Convert usernames (@) into links
$xtwit = preg_replace("(@([a-zA-Z0-9\_]+))", "<a href=\"http://www.twitter.com/\\1\" rel=\"external\">\\0</a>", $xtwit);
// Convert hash tags (#) to links
$xtwit = preg_replace('/(^|\s)#(\w+)/', '\1<a href="http://search.twitter.com/search?q=%23\2" rel="external">#\2</a>', $xtwit);
//Specifically for non-English tweets, converts UTF-8 into ISO-8859-1
$xtwit = iconv("UTF-8", "ISO-8859-1//TRANSLIT", $xtwit);
?>
<li>
<span class="update"><?php echo $xtwit; ?></span><br />
<span class="date"><abbr class="timeago" title="<?php echo $item->get_date('c'); ?>"><?php echo $item->get_date('c'); ?></abbr></span>
</li>
<?php
endforeach;
unset($rss);
}
?>
</ul>
Note: Use the jQuery timeago plugin to parse PHP date stamps into twiiter like time stamps.
Published on November 15, 2011Google Analytics Asynchronous Loading
Tired of ga.js holding up the load time of your site. Give the code below a try and have it load in-line with your content.
<script>
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']); <!-- Change this to your site ID -->
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
</script>
Many thanks to mathiasbynens.be for sharing.
Published on October 20, 2011New Micro CSS Clearfix Hack
So, yet again there is a new clearfix method that will lighten our bloated CSS files.
/* For modern browsers */
.cf:before,
.cf:after {
content:"";
display:table;
}
.cf:after {
clear:both;
}
/* For IE 6/7 (trigger hasLayout) */
.cf {
zoom:1;
}
New hack thanks to Nicolas Gallagher. Please read his article for explanation.
Published on October 19, 2011SEO Best Practices
Good SEO is a by-product of not being a dick on the internet
Nuff said.
Published on October 6, 2011Chunk arrays with php
For a while now I have been using a bit of code for reading the contents of a directory, pushing the found items into an array, then looping over the array with a foreach to create markup for a slideshow, header images, backgrounds, etc. A current project I am working on needs this same functionality but with a twist. I still need to loop over the directory but I need to group the contents into groups or chunks. Enter, PHP’s array_chunk(). This does exactly what I need, but to get the array’s contents neatly on screen I am nesting a set of foreach loops. One for the first subarray, then the other for that subarray’s contents. It goes something like this:
// Initialize the array to hold images
$thelist = array();
// Open directory and add files into array
if ($handle = opendir($dir_path)) {
// Loop over the directory.
while (false !== ($file = readdir($handle))) {
// Don't include the "." and
// ".." files. As well as the
// DS_Store files left by the Mac OS
if ( $file != "." && $file != ".." && $file != ".DS_Store" ) {
array_push($thelist,$file);
}
}
closedir($handle);
}
natsort($thelist); // Put the array in alphabetical order
//shuffle($thelist); // Put the array in random order
// Split array into chunks
$subarray = (array_chunk($thelist, 5));
// Layout the contents
echo "<ul>\n";
foreach ($subarray as $arraygroup) {
echo "<li>";
foreach ($arraygroup as $arrayitem) {
// Do pretty markup here
echo "<p>Item: $arrayitem</p>";
} // END nest
echo "</li>";
} // END main
echo "</ul>\n";
Published on August 31, 2011