This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A structural issue I've been thinking about a lot lately is routing in single page apps. | |
S.P.A.'s are great. They can increase speed (== UX++) and reduce the load on your server. | |
However, routing can be tricky and they can become a barrier to progressive enhancement. | |
1. How to set up your server side routing | |
Server can accept either hash uri's (/#/foo/bar) or hashless uri's (/foo/bar) | |
These should have the same result with the exception of the client not reloading the page when the hash is present | |
2. On an initial page load, serve pre-rendered html on the initial request. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function caps(str) { | |
return str.replace(str[0], str[0].toUpperCase()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.addthis_toolbox.addthis_default_style.addthis_32x32_style | |
%a.addthis_button_facebook | |
%a.addthis_button_twitter | |
%a.addthis_button_tumblr | |
%a.addthis_button_pinterest_share | |
%a.addthis_button_compact | |
%script{src: "//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-538759146c05abe0", type: "text/javascript"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def score(dice) | |
score = 0 | |
#checks for empty array | |
if dice == [] | |
return score | |
else | |
#avoids double counting | |
tempdice = dice.uniq | |
dice.sort! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//d3 | |
var graph = {'name':'Project', 'children':[ | |
{'name':'analytics', 'children':[ | |
{'name':'cluster', 'children':[ | |
{'name':'AgglomerativeCluster', 'size':3938}, | |
{'name':'CommunityStructure', 'size':3812}, | |
{'name':'HierarchicalCluster', 'size':6714}, | |
{'name':'MergeEdge', 'size':743} | |
]}, | |
{'name':'graph', 'children':[ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//admin.js (browser) | |
Team.requestInfo(sport, fn){ | |
//calls ESPN for [team objects] by sport | |
fn(record) | |
} | |
//teams.js (routes) | |
Team.pullData(data, sport, leagueName, leagueShortName){ | |
var object = {}; |