Skip to content

Instantly share code, notes, and snippets.

View mikedamage's full-sized avatar

Mike Green mikedamage

View GitHub Profile
$.ajax({
dataType: 'jsonp',
data: { count: 3, callback: 'twitterFeed' },
url: 'http://twitter.com/statuses/user_timeline/mikedamage.json',
jsonp: 'twitterFeed'
});
function twitterFeed(feed) {
for (var i=0; i<feed.length; i++) {
$('#twitter-status ul').append('<li class="tweet">'
+ feed[i].text
+ '<br/><em>'
+ jQuery.timeago(parseDate(feed[i].created_at))
+ '</em>'
+ '</li>');
}
}
require 'fileutils'
require 'tempfile'
module Webby
module Filters
# The Tidy filter is used to process HTML (or XHTML) through the _tidy_
# program and outpu nicely formatted and correct HTML (or XHTML).
#
# Options can be passed to the _tidy_ program via the
# = Sinatra Action: Minify Javascript
#
# == Summary
# Takes JS files from the public directory and minifies them using the JSMin Rubygem
get '/js/minify/:file' do
content_type 'text/javascript', :charset => 'utf-8'
@file = Pathname.new("./public/javascripts/" + params[:file])
@mini = JSMin.minify(@file.read)
@mini
# = Sinatra Action: Sass Stylesheet Compressor/Renderer
#
# == Summary
# Renders Sass stylesheets in the specified format.
# Valid formats are: extended, expanded, compact, compressed
get "/sass/:format/:file" do
content_type 'text/css', :charset => 'utf-8'
if params[:file] =~ /\.sass$/
@file = Pathname.new("./views/sass/" + params[:file])
@mikedamage
mikedamage / hello.rb
Created January 31, 2009 23:13
Hello world script
puts 'hello world.'
@mikedamage
mikedamage / gists.user.js
Created February 2, 2009 00:54
A Fluid Userscript for Github Gists
// ==UserScript==
// @name github.gists
// @namespace http://mikedamage.github.com
// @description Adds a few site specific dock menu items to Github Gists.
// @include http://gist.github.com/*
// @author Mike Green
// ==/UserScript==
(function () {
if (window.fluid) {
$(document).ready(function() {
// All our code goes here...
});