This file contains hidden or 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
/* You can use any element aside from the example below. | |
How it works is that you simply create .hover, .active styles | |
for whatever element you use this on. Works very well. Uses | |
the underscore hack to targe ie6. | |
*/ | |
input, button { | |
_azimuth: expression( | |
this.onmousedown = this.onmousedown || new Function("this.className += ' active'"), | |
this.onmouseup = this.onmouseup || new Function("this.className = this.className.replace('active','')"), |
This file contains hidden or 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
// USAGE EXAMPLE (in HTML) | |
// <script type="text/javascript"> | |
// new ResizingTextArea("dom_id_for_textarea_here"); | |
// </script> | |
var ResizingTextArea = Class.create(); | |
ResizingTextArea.prototype = { | |
defaultRows: 2, | |
This file contains hidden or 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
# 1) Point *.example.com in your DNS setup to your server. | |
# | |
# 2) Setup an Apache vhost to catch the star pointer: | |
# | |
# <VirtualHost *:80> | |
# ServerName example.com | |
# ServerAlias *.example.com | |
# </VirtualHost> | |
# | |
# 3) Set the current account from the subdomain |
This file contains hidden or 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
# | |
# Inspired by | |
# http://dev.rubyonrails.org/svn/rails/plugins/account_location/lib/account_location.rb | |
# | |
module SubdomainAccounts | |
def self.included( controller ) | |
controller.helper_method(:account_domain, :account_subdomain, :account_url, :current_account, :default_account_subdomain, :default_account_url) | |
end | |
protected |
This file contains hidden or 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
/* | |
Reset | |
By Eric Meyers | |
PURPOSE: | |
Resets everything to zero for better browser compatibility | |
html, body, div, span, object, iframe, h1, h2, h3, h4, h5, p, blockquote, pre, a, | |
abbr, acronym, address, big, cite, code, small, strike, strong, sub, sup, tt, var, |
This file contains hidden or 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 'csv' | |
CSV.open('sample_users.csv', 'r').each do |row| | |
User.create(:username => row[0], :email => row[1]) | |
end |
This file contains hidden or 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
# Simple example | |
# Regex is between these -> \\ and my replacement string is in single quotes | |
def change_p_tags_to_divs(content) | |
content.gsub(\<.*?(p)>\, 'div') | |
end | |
# Complex example | |
# This (real) example puts `@tags` in a hyperlink, finds a path (if any) and then spits out the result. |
This file contains hidden or 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
# Rails modules for user controllers and models. | |
module Tiny | |
module Controller | |
module Accounts | |
def self.included(controller) | |
controller.helper_method( | |
:current_account, | |
:account_domain, | |
:account_subdomain, |
This file contains hidden or 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
# To parse a tweet from twitter to get teh '@' , '#' and the text seperated | |
parsed_text = tweet.text.gsub(/ ?(@\w+)| ?(#\w+)/) { |a| ((a.include?('#')) ? tags : replies) << a.strip.gsub(/#|@/,''); '' } |
OlderNewer