Skip to content

Instantly share code, notes, and snippets.

@jonathanhudak
jonathanhudak / gist:94f6520a4a2a2a1e3a76
Created June 13, 2014 19:41
localize script wordpress
$THEME_DIRECTORY = array( 'path' => get_bloginfo('template_url'));
$WP_DIRECTORY = array( 'path' => home_url());
wp_localize_script( 'app', 'site', $WP_DIRECTORY );
wp_localize_script( 'app', 'theme', $THEME_DIRECTORY );
wp_localize_script( 'app', 'posts', $posts_w_meta)
@jonathanhudak
jonathanhudak / gist:9964a6486420a875030b
Last active August 29, 2015 14:02
sorting array of hashes
def getUserInfo(client, name)
friendTweets = client.user_timeline(name)
@tweets = Array.new
friendTweets.each do | tweet |
text = tweet.text if tweet.is_a?(Twitter::Tweet)
vowels = text.scan(/[aeiou]/).count
tweetInfo = {'text' => text, 'vowels' => vowels}
@tweets.push(tweetInfo)
arrayOfHashes = [{'count' => 5}, {'count' => 3}, {'count' => 8}];
puts arrayOfHashes.sort_by { |hash| hash[:count]}
@jonathanhudak
jonathanhudak / index.html
Created June 28, 2014 21:29
A Pen by Jonathan Hudak.
<header id="topBar">
<a href="#menu" class="toggleMenu">&#9776;</a>
</header>
<nav id="menu">
<a href="#">one</a>
<a href="#">two</a>
<a href="#">three</a>
<a href="#">four</a>
<a href="#">five</a>
@jonathanhudak
jonathanhudak / index.jade
Created August 16, 2014 17:56
A Pen by Jonathan Hudak.
#scene
Q = require 'q'
_ = require 'lodash'
delay = (ms) ->
deferred = Q.defer()
setTimeout deferred.resolve, ms
return deferred.promise
App =
nums: []
@jonathanhudak
jonathanhudak / index.html
Created April 23, 2013 02:26 — forked from mfkp/index.html
ajax mailchimp signup form
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="jquery.ketchup.all.min.js" type="text/javascript"></script>
</head>
<body>
<div id="email">
<span>Enter your email to sign up</span>
<form action="/subscribe.php" id="invite" method="POST">