Skip to content

Instantly share code, notes, and snippets.

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

Eric Allen ericrallen

🎮
https://dvdagames.com
View GitHub Profile
@ericrallen
ericrallen / .bash_profile
Created October 5, 2015 20:48
Bash Stuff
# Load the .bashrc configuration whenever .bash_profile (this file) is sourced
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
@ericrallen
ericrallen / cards.js
Created September 25, 2014 21:10
Girl Develop It! Charlotte - JavaScript for Beginners - Generate and Shuffle a Deck of Cards
/*-----------------------------------------------------------------------------------
Shuffle Example - build and shuffle a deck of cards
This was built during a presentation for Girl Develop It! Charlotte's
Beginner JavaScript class on Loops, Arrays, Objects, and Functions.
It started as a hopefully simple example of how one could use arrays to do
something programmatically and then got a little out of hand.
@ericrallen
ericrallen / gist:9945057
Created April 2, 2014 23:00
Weather Status Code Mapping for Open Weather Maps API
//convert the status id returned from openweathermap.org
function convertWeatherID(id) {
var returnWeather = '';
//check the ID
switch(id) {
//STORM
case 200:
case 201:
case 210:
@ericrallen
ericrallen / index.js
Last active August 29, 2015 13:56
phonegap app javascript module for jQuery 2
'use strict';
(function($) {
//toggle this between true and false to allow/disallow testing the app in the browser
window.localApp = true;
window.app = (function() {
//this object will store methods and variables that will be accessible outside of the window.app module
var pub = {};
@ericrallen
ericrallen / Developer Instagram Feed Output
Last active January 3, 2016 01:59
Using Developer Instagram Feed
<?php if(function_exists('DIF_get_user_images')) {
$test = DIF_get_user_images($user_id); //replace $user_id with the ID of the user you'd like to get the feed for
if($test) {
foreach($test as $image) {
echo '<pre>';
print_r($image);
echo '</pre>';
@ericrallen
ericrallen / config.ru
Created October 11, 2013 02:15
Commented out one line from the config.ru found at https://gist.github.com/brianpattison/4129846 because it was preventing CSS and JS from loading on my local WordPress sites.
# config.ru for Pow + Wordpress, based on http://stuff-things.net/2011/05/16/legacy-development-with-pow/
# added hackery to work around wordpress issues - Patrick Anderson ([email protected])
# clearly this could be cleaner, but it does work
require 'rack'
require 'rack-legacy'
require 'rack-rewrite'
# patch Php from rack-legacy to substitute the original request so
# WP's redirect_canonical doesn't do an infinite redirect of /
@ericrallen
ericrallen / xip.io.scpt
Last active December 25, 2015 03:18
copy xip.io URL for current project to clipboard
-- generates xip.io url with optional port
-- I store this script in my ~/bin directory and then use `ln -s ~/bin/xip.io.scpt` to create a symbolic link in the folder for my current project
-- Here's the funciton in my ~/.bashrc file:
-- function xipit() {
-- port=$@
-- if [ ! -f xip.io.scpt ]; then
-- ln -s ~/bin/xip.io.scpt;
-- fi
-- osascript xip.io.scpt $port;
@ericrallen
ericrallen / custom-ajax.php
Created March 29, 2013 08:32
Work in Progress for running custom wp_ajax actions
<?php
/*--------------------------------------------------------------------------
Better AJAX for WordPress
inspired by:
http:wordpress.stackexchange.com/questions/28342/is-there-a-way-to-use-the-wordpress-users-but-without-loading-the-entire-wordpre#answer-45011
--------------------------------------------------------------------------*/
@ericrallen
ericrallen / get-tweets-from-plugin.php
Created January 25, 2013 06:00
Pulls in Twitter feed from specific twitter WordPress plug-in for developers and converts links to anchor tags
<?php
/*--------------------------------------------------------------------------
This pulls in tweets gathered from the WordPress plugin
ouath-twitter-feed-for-developers and converts them into
an <article> tag
It takes retweets into account and then updates links within
the tweet text to convert urls, tags, and hashes into anchor
@ericrallen
ericrallen / relative-date.php
Created January 22, 2013 22:47
Create an estimated relative date for any past date string via PHP.
<?php
/*--------------------------------------------------------------------------
This function accepts any date string that str_to_time() can handle
and returns a relative date string
It can account for seconds, minutes, days, weeks, months, years,
decades, centuries, and millenia