This file contains hidden or 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
freckle: | |
subdomain: [subdomain] | |
authtoken: [api key] | |
user: [username] |
This file contains hidden or 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
Queue = function(){ | |
var timer = 1000; | |
var run = true; | |
var theQueue = [1,2,3,4,5]; | |
var doSomething = function(thing){ | |
//do something with the thing | |
}; | |
var process = function(){ | |
if(theQueue.length > 0){ | |
doSomething(theQueue.shift()); |
This file contains hidden or 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
preloadImages = { | |
count: 0 /* keep track of the number of images */ | |
,loaded: 0 /* keeps track of how many images have loaded */ | |
,onComplete: function(){} /* fires when all images have finished loadng */ | |
,onLoaded: function(){} /*fires when an image finishes loading*/ | |
,loaded_image: "" /*access what has just been loaded*/ | |
,images: [] /*keeps an array of images that are loaded*/ | |
,incoming:[] /*this is for the process queue.*/ | |
/* this will pass the list of images to the loader*/ |
This file contains hidden or 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
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<title>css transitions</title> | |
<script src="jquery-1.5.1.min.js" type="text/javascript" charset="utf-8"></script> | |
<style type="text/css"> | |
* { | |
margin: 0; |
This file contains hidden or 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 clearDb(){ | |
localStorage.clear(); | |
console.log("Cleared the local storage, god help us all."); | |
} | |
//hurrah HTML5 local storage, I'm using a singly linked list as i'm lazy. | |
function store(msgs){ | |
if(!localStorage){ | |
console.error('Browser doesn\'t support local storage, in memory only I\'m afraid'); | |
return; |
This file contains hidden or 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
//searchController | |
function search(){ | |
var searchTerm = $('#search').text(); | |
$.forEach(elemement, $('#questions > li')){ | |
if(!element.text().match(searchTerm)>0){ | |
element.hide(); | |
}else( | |
element.show(); | |
) |
This file contains hidden or 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
$.getJSON("http://query.yahooapis.com/v1/public/yql?" + | |
"q=select%20*%20from%20html%20where%20url%3D%22" + | |
encodeURIComponent(uri) + | |
"%22&format=xml'&callback=?", | |
function(data) { | |
//do something CORS rules wouldn't let you | |
} | |
); |
This file contains hidden or 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
Ribbit.getAuthenticatedUserIniFrame = function(callback, name, windowOptions) { | |
var win = null; | |
var gotUrlCallback = function(result) { | |
console.log(result); | |
if (result.hasError) { | |
callback(new Ribbit.RibbitException("Cannot get request token, check application credentials.", 0)); //the request for an oAuth uri has gone wrong | |
} else { | |
var timeOutPoint = new Date().getTime() + 300000; | |
var pollApproved = function() { | |
var callback = function(val) { |
This file contains hidden or 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 dateMe(date){ | |
var now = new Date(); | |
var d = new Date(date); | |
if(now.getDay()==d.getDay() && now.getMonth()==d.getMonth() && now.getFullYear()==d.getFullYear()){ | |
return d.toTimeString().match(/\d+:\d+/); | |
}else if(now.getDay()==d.getDay()+1 && now.getMonth()==d.getMonth() && now.getFullYear()==d.getFullYear()){ | |
return 'Yesterday'; | |
}else{ | |
return d.toLocaleDateString().match(/\d+\s\D{3}/); | |
} |