Skip to content

Instantly share code, notes, and snippets.

<?php
// show.php
class Show extends AppModel {
var $hasAndBelongsToMany = array('User');
}
// user.php
class User extends AppModel {
var $hasAndBelongsToMany = array('Show');
# This will be a simple Brightkite script
require 'rubygems'
require 'activeresource'
class BrightkiteBase < ActiveResource::Base
self.site = 'http://brightkite.com'
self.user = USERNAME
self.password = PASSWORD
end
class Person < BrightkiteBase
<style type="text/css">
html #vidget_1829715806 { overflow: auto; width: 199px; }
html #vidget_1829715806 h2 { clear: both; }
html #vidget_1829715806 ul { list-style-type:none; margin: 0; padding:
0; overflow: auto;}
html #vidget_1829715806 li { float: left; margin: 0 0 10px
10px!important; padding: 0; width: 59px; overflow: hidden; text-align:
center; }
html #vidget_1829715806 li.first { clear: left; margin-left: 0!important; }
/*
jQuery Font Detection Plugin by Kyle Slattery (http://kyleslattery.com)
Used to determine if a font is installed on a user's computer
Inspired by: http://remysharp.com/2008/07/08/how-to-detect-if-a-font-is-installed-only-using-javascript/
Use:
if($.fontInstalled('Helvetica')) {
// font is installed
} else {
# This script auto deletes any entries you've imported
# to Tumblr via an RSS Feed
require 'rubygems'
require 'httparty'
# Config
tumblr_address = "http://you.tumblr.com"
email = "you@you.com"
password = "password"
# Helpful stuff from: http://chrisblunt.com/blog/2009/04/18/rails-writing-dry-custom-validators/
ActiveRecord::Base.class_eval do
def self.validates_as_file(*attr_names)
options = {:max_size => 1, :extensions => '.txt'}.merge(attr_names.extract_options!)
options[:extensions] = [options[:extensions]] unless options[:extensions].is_a?(Array)
validates_each(attr_names, options) do |record, attr_name, value|
unless value.is_a?(Tempfile)
record.errors.add(attr_name, 'must be a file')
class ContactEmail < ActiveRecord::BaseWithoutTable
column :name, :string
column :from, :string
column :body, :text
validates_presence_of :name, :from, :body
validates_format_of :from, :with => Post::EMAIL_FORMAT
def send!
if valid?
<?php
/*
=====================================================
ExpressionEngine - by EllisLab
-----------------------------------------------------
http://expressionengine.com/
-----------------------------------------------------
Copyright (c) 2003 - 2009, EllisLab, Inc.
=====================================================
RewriteRule ^notebook/(entries|links|photos|tags)(.*) /$1$2 [R=301]