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
require.paths.unshift('../../express.js/lib') | |
require('express') | |
require('express/plugins') | |
configure(function(){ | |
use(Logger); | |
use(Static); | |
set('root',__dirname); | |
}); |
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
//REQUIRE | |
var express = require('express'); | |
var app = module.exports = express.createServer(); | |
//CONFIG | |
app.configure(function(){ | |
app.use(express.methodOverride()); | |
app.use(express.bodyDecoder()); | |
app.use(app.router); | |
app.use(express.compiler({ src: __dirname + '/public', enable: ['less'] })); |
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 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}/); | |
} |
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
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 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 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 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 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 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*/ |
OlderNewer