Skip to content

Instantly share code, notes, and snippets.

View jlindley's full-sized avatar

Jim Lindley jlindley

View GitHub Profile
@jlindley
jlindley / jquery.deletable.js
Created July 22, 2008 02:18
Merb/jQuery: add delete method to destroy links.
// Make merb resource route url link_to's with class deletable fake delete HTTP method.
jQuery.fn.deletable = function() {
return this.each(function() {
var delete_link = $(this);
var hidden_form = document.createElement('form');
hidden_form.style.display = 'none';
delete_link.append(hidden_form);
hidden_form.method = 'POST';
hidden_form.action = delete_link.attr('href');
# AR Object dup vs marshal benchmarks
#
# re: http://rails.lighthouseapp.com/projects/8994/tickets/785
#
# user system total real
# string saved in hash 0.050000 0.000000 0.050000 ( 0.048411)
# string marshalling 0.580000 0.020000 0.600000 ( 0.659637)
#
# object saved in hash 0.040000 0.000000 0.040000 ( 0.047936)
# object marshalling 9.240000 0.170000 9.410000 ( 9.932777)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>#1068 Tags in posts not auto-closed. - Lighthouse Users - activereload</title>
<link rel="shortcut icon" href="/images/favicon.gif" type="image/gif" />
<link href="/stylesheets/core.css?1218411940" media="screen" rel="stylesheet" type="text/css" />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>#1068 Tags in posts not auto-closed. - Lighthouse Users - activereload</title>
<link rel="shortcut icon" href="/images/favicon.gif" type="image/gif" />
<link href="/stylesheets/core.css?1218411940" media="screen" rel="stylesheet" type="text/css" />
# Controller for the Social leaf.
class Controller < Autumn::Leaf
include Formatting::Mirc
def did_receive_channel_message(stem, sender, channel, msg)
unless sender[:nick].match(/pixie/)
logger.debug "I heard from #{sender[:nick]}"
text_source = "kafka.txt"
if msg.downcase.match(/beam|scott|space|star|trek|kirk|data/)
alias both="git diff HEAD"
alias log="git log"
alias st="git status"
alias br='git branch'
alias bra='git branch -a'
alias push="git push"
alias pull="git pull"
alias gci='git commit -v'
alias gcia='git commit -v -a'
alias gdm='git diff | mate'
# RSpec ticket: http://rspec.lighthouseapp.com/projects/5645/tickets/589
# see output and version string below...
require 'rubygems'
require 'spec'
class ApplicationModel
def self.address_attribute(address)
define_method "#{address}_attribute=" do |attributes|
load_address(address, attributes)
<div style="width: 100%; background: #6C3030; color: #DDD; padding-top: 0.2em; padding-bottom: 0.2em;text-align: right; ">
<a style="color:white;display:block;margin:0.2em 0.4em;" href="http://192.168.0.18">Internal Apps Index</a>
</div>
if rails_env = ENV['RAILS_ENV']
rails_root = File.basename(Dir.pwd)
rails_env_string = case rails_env
when 'development'
'dev'
when 'production'
'prod'
else
rails_env
<html>
<head>
<script type="text/javascript">
function is_it_private(){
var is_private_element = document.getElementsByName("is_private")[0];
alert("Value is " + is_private_element.checked );
}