Skip to content

Instantly share code, notes, and snippets.

View kylerush's full-sized avatar

Kyle Rush kylerush

  • New York, NY
View GitHub Profile
@kylerush
kylerush / full.js
Created January 8, 2012 21:23
JavaScript epoch time convert number prototype
Number.prototype.timeLeft = function(){
var days = Math.floor(this / 86400);
var hours = Math.floor((this - (days * 86400)) / 3600);
var minutes = Math.floor((this - ((hours * 3600) + (days * 86400))) / 60);
var seconds = this - ((days * 86400) + (hours * 3600) + (minutes * 60));
@kylerush
kylerush / build-html.js
Last active October 25, 2018 13:25
Detailed Flickr photo wall tutorial
function(data){
//loop through the results with the following function
$.each(data.photoset.photo, function(i,item){
//build the url of the photo in order to link to it
var photoURL = 'http://farm' + item.farm + '.static.flickr.com/' + item.server + '/' + item.id + '_' + item.secret + '_m.jpg'
//turn the photo id into a variable
var photoID = item.id;
@kylerush
kylerush / default.html
Created January 11, 2013 15:32
The Jekyll layout for kylerush.net.
<!doctype html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
{% comment %}<meta charset="utf-8">{% endcomment %}
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>{% if page.title %}{{ page.title }}{% endif %}</title>
<meta name="description" content="{{ page.description }}">
@kylerush
kylerush / about.html
Created January 11, 2013 15:39
This is an example of a page in Jekyll.
---
layout: default
body_id: about
title: About Kyle Rush
description: I optimize web apps for performance, conversions and user experience. I am the Deputy Director of Frontend Development at Obama for America.
---
<div id="kyle-rush-img" class="img"></div>
<p>Hi, my name is Kyle Rush. I work on web apps and focus most of my efforts on optimizing the user experience. That means I get too much excitement of making things load faster, optimizing for conversions with a/b and multivariate tests and using analytic data to improve how users interact with web apps.</p>
@kylerush
kylerush / post.html
Created January 11, 2013 15:49
An example Jekyll blog post.
---
layout: post_entry
body_id: blog
title: How to use the Flickr API
description: In this tutorial, you'll learn how the basics of using the Flickr API, requesting data in JSON format, experimenting with an optional argument, and what to do with the data you receive from a request.
---
<!--blog post html content here-->
@kylerush
kylerush / blog-loop.html
Created January 11, 2013 15:52
An example of a blog post loop in Jekyll.
{% for post in site.posts %}
<article class="{% if forloop.first %}first{% elsif forloop.last %}last{% else %}middle{% endif %}">
<div class="article-head">
<h2 class="title"><a href="/{{ post.url }}/" class="js-pjax">{{ post.title }}</a></h2>
<p class="date">{{ post.date | date: "%b %d, %Y" }}</p>
</div><!--/.article-head-->
<div class="article-content">
{{ post.long_description }}
<a href="/{{ post.url }}/" class="full-post-link js-pjax">Read more</a>
</div><!--/.article-content-->
@kylerush
kylerush / .maxcdn
Created January 22, 2013 18:07
Example .maxcdn config file
[maxcdn]
alias = aliashere
consumer_key = consuerkeyhere
consumer_secret = consumersecrethere
@kylerush
kylerush / .aws
Created January 22, 2013 18:08
.aws config file example
[s3]
access_id = accessidhere
secret_key = secretkeyhere
@kylerush
kylerush / s3-maxcdn-deploy.py
Created January 22, 2013 18:09
Git, S3 and MaxCDN Python deploy script. The script gets the changed file between the two latest Git commits, uploads the changed files to S3 and then purges the paths from MaxCDN using the API.
#!/usr/bin/env python
#install the follow first:
#sudo easy_install pip
#sudo pip install -U boto
#sudo pip install configparser
@kylerush
kylerush / form-field-error.js
Last active December 23, 2018 18:12
Google Analytics custom event example to reduce user frustration.
_gaq.push(['_trackEvent', 'Donate error', 'field validation error', 'email']);