Skip to content

Instantly share code, notes, and snippets.

View kylerush's full-sized avatar

Kyle Rush kylerush

  • New York, NY
View GitHub Profile
assemble: {
options: {
layoutdir: '<%= config.src %>/templates/layouts',
},
posts: {
options: {
flatten: true,
layout: 'entry.hbs',
ext: '.html'
},
dist/
blog/
post1.html
post2.html
post3.html
index.html
src/
content/
blog/
post1.hbs
jQuery.get('/account/info').always(function(data, textStatus, jqXHR){
if(jqXHR.status === 200){
try{
if(typeof data.userName === 'string'){
if(data.userName !== ''){
jQuery.get('/account/info').always(function(data, textStatus, jqXHR){
if(jqXHR.status === 200){
try{
if(typeof data.userName === 'string'){
if(data.userName !== ''){
jQuery.get('/account/info').always(function(data, textStatus, jqXHR){
if(jqXHR.status === 200){
try{
jQuery('#user-name').text(data.userName);
} catch(error){
jQuery.get('/account/info').always(function(data, textStatus, jqXHR){
if(jqXHR.status === 200){
jQuery('#user-name').text(data.userName);
}
});
jQuery.get('/account/info', function(data){
jQuery('#user-name').text(data.userName);
});
@kylerush
kylerush / default.js
Created March 5, 2014 03:44
Code example for a blog post "Tips for consuming JSON APIs in JavaScript."
jQuery.get('/account/info', function(data){
jQuery('#user-name').text(data.userName);
});
@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']);
@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