This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// show.php | |
class Show extends AppModel { | |
var $hasAndBelongsToMany = array('User'); | |
} | |
// user.php | |
class User extends AppModel { | |
var $hasAndBelongsToMany = array('Show'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This will be a simple Brightkite script |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'activeresource' | |
class BrightkiteBase < ActiveResource::Base | |
self.site = 'http://brightkite.com' | |
self.user = USERNAME | |
self.password = PASSWORD | |
end | |
class Person < BrightkiteBase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 = "[email protected]" | |
password = "password" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
===================================================== | |
ExpressionEngine - by EllisLab | |
----------------------------------------------------- | |
http://expressionengine.com/ | |
----------------------------------------------------- | |
Copyright (c) 2003 - 2009, EllisLab, Inc. | |
===================================================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteRule ^notebook/(entries|links|photos|tags)(.*) /$1$2 [R=301] |
OlderNewer