Skip to content

Instantly share code, notes, and snippets.

View ericrallen's full-sized avatar
🎮
https://blog.dvdagames.com

Eric Allen ericrallen

🎮
https://blog.dvdagames.com
View GitHub Profile
@ericrallen
ericrallen / [Wordpress] Twitter Search API with WP Transient Caching
Created October 4, 2012 20:34
Wordpress Twitter Search API simple integration with 2 levels of wp transient caching for fallback
<?php //get tweets
function get_tweets($s) {
$url = 'http://search.twitter.com/search.json?q=' . urlencode($s);
//set up var for holding tweets
$local_tweets = '';
//check for cache from 5 minutes ago
if(get_transient('bodyadorned_tweets_short')) {
$local_tweets = get_transient('bodyadorned_tweets_short');
//if it isn't found, try to update tweets
} else {
@ericrallen
ericrallen / sublime-text-2-scheme
Created August 21, 2012 22:59
My Sublime Text 2 Color Scheme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>comment</key>
<string>Crafted with love and passion by Bernat Fortet, special treatment for Front End coding: HTML, CSS, LESS, JADE, JS... more coming soon </string>
<key>author</key>
<string>Bernat Fortet</string>
<key>name</key>
<string>Bernat's FrontEnd Deligh</string>
@ericrallen
ericrallen / js-ua-checker
Created August 1, 2012 18:16
JavaScript UA Checker, modified from http://bit.ly/nMEXh4 to represent ipad, as well.
//check for mobile devices
//modified from http://bit.ly/nMEXh4
var ua = navigator.userAgent;
var checker = {
iphone: ua.match(/(iPhone|iPod)/),
ipad: ua.match(/(iPad)/),
blackberry: ua.match(/BlackBerry/),
android: ua.match(/Android/)
@ericrallen
ericrallen / gist:3220635
Created July 31, 2012 21:15
Remove "or Create An Account" from BigCommerce Sign In link but preserve Sign In/Sign Out functionality
//the next few lines strip "or Create an Account" from the log-in menu option
//I usually set the overall navigation to display:none; in my CSS if I know js is enabled
//I use Modernizr and check for the js class on the <html> tag with the style selector for my menu
//like: .js #navigation { display: none; }
//You'll want to add a class or ID to the <div> containing the log-in/log-out link
//usual output (with added ID):
//<li>
// <div id="log_in_options">
// <a onclick="" href="[url]">Sign in</a> or <a onclick="" href="[url]">Create an account</a>