Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html lang="en">
<head>
<title>eHarbor</title>
<%= stylesheet_link_tag 'boilerplate', 'main' %>
<%= javascript_include_tag :defaults %>
<!--[if IE]>
<%= javascript_include_tag 'http://html5shiv.googlecode.com/svn/trunk/html5.js' %>
<![endif]-->
</head>
$('input, textarea').live('keyup click change', function() {
if(this.defaultValue != this.value) {
$(this.form).trigger('changed');
}
});
$('form').live('changed', function() {
$(this).data('dirty', true);
}).live('submit', function() {
var wasDirty = $(this).data('dirty');
$(this).data('dirty', false);
class List
include MongoMapper::Document
key :name, String, :required => true
many :users, :foreign_key => 'list_ids'
end
jQuery.fn.wordWrap = function () {
// This splits any text node by spaces, and any 'word' that is longer than 26 characters it
// splits apart each character by a <wbr> tag so it breaks if it needs to.
return this.each(function () {
var walker = document.createTreeWalker(this, NodeFilter.SHOW_TEXT, null, false);
while (walker.nextNode()) {
var node = walker.currentNode;
var parts = node.nodeValue.split(' ');
for (i = 0; i < parts.length; i++) {
if (parts[i].length > 26) parts[i] = parts[i].split('').join(String.fromCharCode('8203'))
From: Mail Delivery Subsystem <MAILER-DAEMON@isadora.cybox.com>
Subject: Returned mail: see transcript for details
Date: September 5, 2009 11:11:42 AM EDT
To: Daniel Morrison <daniel@collectiveidea.com>
The original message was received at Sat, 5 Sep 2009 09:11:42 -0600
from mail-yx0-f195.google.com [209.85.210.195]
----- The following addresses had permanent fatal errors -----
<terrys@breakthroughsys.com>
@collectiveidea
collectiveidea / application.html.erb
Created August 21, 2009 19:59
How to get jQuery to work with Rail's Authenticity Token (protect_from_forgery)
<!DOCTYPE html>
<html>
<head>
<title>My Rails App</title>
<%- if protect_against_forgery? -%>
<meta name="authenticity-token" id="authenticity-token" content="<%= form_authenticity_token %>" />
<%- end -%>
<%= javascript_include_tag 'jquery', 'rails' %>
</head>
<body>
@collectiveidea
collectiveidea / favicon.js
Created May 1, 2009 00:49
display favicons next to links
// Requires prototype.js
// assumes you have some container with class .favicon with a bunch of links inside
// As seen on http://ideafoundry.info/embassy
// Documentation at http://daniel.collectiveidea.com/blog/2009/5/1/fun-with-favicons
function loadFavicons() {
$$('.favicon a').each(function(link){
link.setStyle({
background: 'url('+link.href+'favicon.ico) no-repeat 0 0',
paddingLeft: '24px'