Skip to content

Instantly share code, notes, and snippets.

View andrew's full-sized avatar
🚙
I may be slow to respond.

Andrew Nesbitt andrew

🚙
I may be slow to respond.
View GitHub Profile
/* http://meyerweb.com/eric/tools/css/reset/
/* v1.0 | 20080212
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
require File.dirname(__FILE__) + '/../test_helper'
class CommentsControllerTest < ActionController::TestCase
def setup
Factory.create(:comment)
end
should_route :get, "posts/hello-world/comments", :post_id => 'hello-world', :controller => :comments, :action => :index
should_route :get, "posts/hello-world/comments/new", :post_id => 'hello-world', :action => :new
require 'autotest/fsevent'
module Autotest::Growl
def self.growl title, msg, img, pri=0, stick=""
system "growlnotify -n autotest --image #{img} -p #{pri} -m '#{msg}' #{title} #{stick}"
end
Autotest.add_hook :red do |at|
errors = at.files_to_test.map { |k, v| "#{k}:\n #{v.join("\n ")}"}.join("\n\n")
#failed_tests = at.files_to_test.inject(0){ |s,a| k,v = a; s + v.size}
def format_datetime_ago(time)
formatted = time.strftime('%d %b %y at %I:%M%p')
if time > 5.days.ago
formatted = "#{time_ago_in_words(time)}"
formatted.insert(0, 'in ') if time > Time.now
formatted.insert(formatted.length, ' ago') if time < Time.now
end
content_tag :abbr, formatted, :title => time.iso8601
#! /usr/bin/ruby
## Elliott Kember's Delete MM_ Script.
# I bet you thought I wouldn't write this!
## Usage:
# $ ruby dreamcatcher.rb emailaddress password
## dreamcatcher.rb
- simple
- public over private
- personal vanity
- internet is global
- permalinks
- one important item per page
- don't break the browser
- don't wanker in technology
- a medium is not a grande
- break convention for your users
<!-- custom ol list-styles -->
<style type="text/css">
ol {
counter-reset: item;
margin-left: 0;
padding-left: 0;
}
li {
display: block;
#!/usr/bin/env ruby
# -*- ruby -*-
require 'rubygems'
require 'daemon-spawn'
RAILS_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
class DelayedJobWorker < DaemonSpawn::Base
def start(args)
ENV['RAILS_ENV'] ||= args.first || 'development'
/*
* jGrow
* jGrow is a jQuery plug-in that makes the textarea adjust its size according to the length of the text.
* @requires jQuery v1.2.3 or later
* @version 0.3
* @author Berker Peksag http://lab.berkerpeksag.com/jGrow
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
<!DOCTYPE html>
<html>
<head>
<meta content='Rails Rumble Countdown' name='description'>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="http://r09.railsrumble.com/javascripts/jquery/countdown.min.js"></script>
<script type="text/javascript">
$(function () {
$('#message').countdown({until: new Date(2009, 7, 23, 25), compact: true, description: '', format: 'HMS', onExpiry: function(){ alert('Time is up!')}});
});