Skip to content

Instantly share code, notes, and snippets.

View voidfiles's full-sized avatar

Alex Kessinger voidfiles

View GitHub Profile
{
'cannonical_link': 'http://www.livemixtapes.com/mixtapes/2184/gang_related.html',
'dj': {
'link': 'http://livemixtapes.com/djs/404/dj_messiah.html',
'name': 'DJ Messiah'
},
'img_url': 'http://images.livemixtapes.com/artists/messiah/gangrelated-5star/tn_cover.jpg',
'score': {
'value': '127',
'views': '31,076',
{
"result": "ok",
"value": {
"more_pics": true,
"last_pic_id": 153217,
"pic_count": 200,
"pics": [
{
"city": {
"url": "/city/san-francisco-ca/",
<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd" securityLevel="any">
<meta>
<author>Picplz</author>
<documentationURL>http://picplz.com</documentationURL>
<sampleQuery>select * from {table} WHERE entity='feed' AND type='interesting'</sampleQuery>
<sampleQuery>select * from {table} WHERE entity='city' AND id=2 AND include_pics=1</sampleQuery>
<sampleQuery>select * from {table} WHERE entity='user' AND username='zubillaga' AND include_pics=1;</sampleQuery>
</meta>
<bindings>
@voidfiles
voidfiles / join_text_url.py
Created February 15, 2011 07:09
Joins a piece of text with a url to form max length tweet
long_tweet = 'asdfasdf asd fasd fasdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdfasdf asdfasdfas dfasd fasd fasdf asdf asdf asdf asdf asdf asdf '
short_tweet = 'asdfasdf asd fasd fasdf asdf asdf asdf asdf asdf asdf asdf asdf'
url = "http://sia.tw/4fgs4"
def join_url(tweet, url):
max_tweet_length = 139
@voidfiles
voidfiles / gist:1046748
Created June 25, 2011 18:33
Parsing Extractiv JSON Crawl Job Output
"""
Extractive is a cool new service that does some on the fly web
crawling, and machine learning stuff like Entity Extraction, Full
text extraction, and more things I don't even understand. There
on demand api was very easy to use, but I built my first crawl
job the other night, and had some trouble parsing the results.
I thought I would put this up so people can see how I fixed the
output.
"""
@voidfiles
voidfiles / gist:1390075
Created November 23, 2011 22:10
Flickr's Pre-script loading event handler code
(function(F) {
var registered_ids = {},
id_to_module_map = {},
interim_actions = {},
cleanup_actions = {},
clicked_ids = {},
queueing = true;
function register_id(id, callbacks, required_module) {
id = id.replace('*', '.*');
@voidfiles
voidfiles / flickr_action_queue.js
Created November 25, 2011 22:43
Flickrs actionQueue code isolated
(function(F) {
var registered_ids = {},
id_to_module_map = {},
interim_actions = {},
cleanup_actions = {},
clicked_ids = {},
queueing = true;
function register_id(id, callbacks, required_module) {
id = id.replace('*', '.*');
@voidfiles
voidfiles / gist:1394631
Created November 25, 2011 23:09
Flickr actionQueue fav handler
F.actionQueue.register('button-bar-fave', {
interim: function(id) {
var fave_button = document.getElementById(id);
if (fave_button.className.search(/fave/) === -1) {
fave_button.className = 'Butt ywa-track fave-button fave';
} else {
fave_button.className = 'Butt ywa-track fave-button';
}
},
cleanup: function(id) {
@voidfiles
voidfiles / flickr_favorite_button.html
Created November 25, 2011 23:22
Flickr Favorite Button
<a href="#" class="Butt ywa-track fave-button fave" id="button-bar-fave" data-ywa-name="Favorites star" onclick="return F.actionQueue.queue_click(this.id);" tabindex="4">
<span class="ie-hack">&nbsp;</span>
<span class="star">★</span> &nbsp;Favorite
</a>
@voidfiles
voidfiles / gist:1394697
Created November 25, 2011 23:49
An article about flickrs pre-script event handler
Production Tear Down
How does flickr handle the problems of loading scripts asynchrounsly.
Wether, or not you are using an asynch loader, or you are puting your script loading at the bottom of your dom you have a problem. In some cases your scripts will load after the user has clicked on something that requires there to be a javascript function to handle the click.
If you have built out a fully accessible site you might have a non-js flow, but that is usually substandard if the user has javascript, and it just is taking to long for your scripts to load. What you need some way of handling events before all of your scripts have finished loading.
First we I am going to take a look at how flickr does this, and then I want to break down a more generic way of doing this.