Skip to content

Instantly share code, notes, and snippets.

run "rm public/index.html"
git :init
plugin "rspec", :git => "git://github.com/dchelimsky/rspec.git", :submodule => true
plugin "rspec-rails", :git => "git://github.com/dchelimsky/rspec-rails.git", :submodule => true
plugin "exception-notifier", :git => "git://github.com/rails/exception_notification.git", :submodule => true
plugin "restful-authentication", :git => "git://github.com/technoweenie/restful-authentication.git", :submodule => true
plugin "semantic-form-builder", :git => "git://github.com/rubypond/semantic_form_builder.git", :submodule => true
plugin "paperclipped", :git => "git://github.com/kbingman/paperclipped.git", :submodule => tru
module ApplicationHelper
# Example Useage:
# <%navigation do |nav|%>
# <%if logged_in? %>
# <%=nav.item :logout%>
# <%=nav.item :posts, :link=>user_posts_url(current_user),
# :selected_if=>Proc.new {|controller| controller.controller_name.to_sym == :posts}%>
# <%else%>
# <%=nav.item :signup%> #uses the signup_url helper
@jduff
jduff / gist:58791
Created February 5, 2009 16:18 — forked from rails/gist:58761
var DateHelper = {
// Takes the format of "Jan 15, 2007 15:45:00 GMT" and converts it to a relative time
// Ruby strftime: %b %d, %Y %H:%M:%S GMT
time_ago_in_words_with_parsing: function(from) {
var date = new Date;
date.setTime(Date.parse(from));
return this.time_ago_in_words(date);
},
time_ago_in_words: function(from) {
class Object
# Useage:
# @user.name.or("blank")
# if @user's name is nil or "", returns "blank", otherwise returns the name
def or(value)
(respond_to?(:empty?) ? empty? : !self) ? value : self
end
end
From f6b4095185f4aff912b3bda59033ed2d259da735 Mon Sep 17 00:00:00 2001
From: John Duff <[email protected]>
Date: Thu, 18 Jun 2009 22:24:00 -0400
Subject: [PATCH] make pass through error code configurable
---
railties/lib/rails/rack/metal.rb | 8 ++++-
.../metal/multiplemetals/app/metal/metal_a.rb | 4 +-
.../metal/multiplemetals/app/metal/metal_b.rb | 4 +-
railties/test/metal_test.rb | 30 ++++++++++++++++++++
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
// insert code here...
NSLog(@"Hello, World!");
NSString *path = @"~";
path = [path stringByExpandingTildeInPath];
#import <Foundation/Foundation.h>
@interface PolygonShape : NSObject {
int numberOfSides;
int minimumNumberOfSides;
int maximumNumberOfSides;
}
@property (assign) int numberOfSides;
@property (assign) int minimumNumberOfSides;
#env
export PATH=/opt/local/bin:/opt/local/sbin:$PATH:/usr/local/mysql/bin
# git aliases
alias gst="git status"
alias gp="git push"
alias gl="git pull"
alias gc="git commit -m"
alias ga="git add"
ENV["WATCHR"] = "1"
system 'clear'
def growl(message)
growlnotify = `which growlnotify`.chomp
title = "Watchr Test Results"
image = message.include?('0 failures, 0 errors') ? "~/.watchr_images/passed.png" : "~/.watchr_images/failed.png"
options = "-w -n Watchr --image '#{File.expand_path(image)}' -m '#{message}' '#{title}'"
system %(#{growlnotify} #{options} &)
end
<html>
<head>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js'></script>
<script>
$(document).ready(function(){
function debug(str){ $("#debug").append("<p>" + str + "</p>"); };
function send_msg_string(str) {
$("#msg").append("<p>[ OUT ]"+str+"</p>");
ws.send(str+"\n");
}