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
-- Fibonacci Sequence Abstraction | |
fib :: Integer -> Integer | |
fib 0 = 1 | |
fib 1 = 1 | |
fib x = fib (x - 1) + fib (x - 2) | |
-- Another Fibonacci Sequence Abstraction | |
fibTuple:: (Integer, Integer, Integer) -> (Integer, Integer, Integer) | |
fibTuple (x, y, 0) = (x, y, 0) | |
fibTuple (x, y, index) = fibTuple(y, x + y, index - 1) |
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
/* | |
**prettyDate** is based on [John Resig's work][1]. | |
[1]: http://ejohn.org/blog/javascript-pretty-date/ "prettyDate" | |
*/ | |
/* PrettyDate - http://ejohn.org/blog/javascript-pretty-date/ | |
------------------------------------------------------------------/ | |
/* | |
* JavaScript Pretty Date | |
* Copyright (c) 2008 John Resig (jquery.com) |
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 twitterify(text) { | |
return text | |
// URLS | |
.replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, | |
"<a href='$1'>$1</a>") | |
// Hashtags | |
.replace(/\B#([^ ]+)\b/ig, | |
"<a href='http://twitter.com/#!/search?q=%23$1'>#$1</a>") |
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
// usage: $(".something").animateNums(300); | |
(function($) { | |
$.fn.animateNums = function(options) { | |
return this.each(function() { | |
e = $(this); | |
var max = e.text(); | |
e.text("0"); | |
animateNums(); | |
function animateNums() { |
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
// iPad fix for position fixed | |
$(window).scroll(function() { | |
if (navigator.platform == 'iPad' || navigator.platform == 'iPhone' || navigator.platform == 'iPod') { | |
$("footer").css({ | |
position: 'absolute' | |
top: ($(document).scrollTop() + $(window).height() - $("footer").height()) + "px" | |
}); | |
} | |
}); |
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
#!/usr/bin/env python | |
# encoding: utf-8 | |
""" | |
Check all available urls from the word list. | |
urls that aren't the exact word aren't considered. | |
""" | |
import urllib | |
import json | |
import re |
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($) { | |
$.fn.vslide = function(options) { | |
var defaults = { | |
slide: '.slide', | |
slide_inner: '.slide-inner' | |
next: '.next', | |
prev: '.prev', | |
slideHeight: 640, | |
slideWidth: 700, | |
vertical: true, |
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
window.old_sync = Backbone.sync | |
Backbone.sync = (method, model, options) => | |
old_sync(method, model, options) | |
model.trigger("loading") |
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
# $(".something").yellow_fade(1000) | |
# underscore.js is used. adapted from http://amix.dk/blog/post/19029 | |
(($) -> | |
$.fn.yellow_fade = (speed) -> | |
# we call this function repeatedly | |
decrease_fade = (e, i, speed) -> | |
shades = ['ff', 'ee', 'dd', 'cc', 'bb', 'aa', '99'] | |
if i # i == 0 | |
e.css 'backgroundColor', "#ffff#{shades[i]}" |
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
#!/usr/bin/env python | |
# encoding: utf-8 | |
""" | |
Check the number of mentions of each name | |
from the baby names list in each year new york times | |
newspapers and search for a coorelation | |
""" | |
import urllib | |
import json |
OlderNewer