Skip to content

Instantly share code, notes, and snippets.

View dirkkelly's full-sized avatar

Dirk Kelly dirkkelly

View GitHub Profile
Event.onReady(function() {
$$('textarea').each(function(inputElement) {
var textarea = inputElement;
var initialHeight = textarea.getHeight();
var currentHeight = -1;
var currentTimer = false;
var div = $div({id: textarea.id + '_hidden'});
textarea.insert({'after': div});
div.setStyle({'display' : 'none',
export RAILS_ENV='development'
export GEM_HOME='/opt/gems'
export GEM_PATH='/opt/gems'
PATH='/opt/ruby/current/bin:/opt/gems:/opt/gems/bin:/opt/nginx/current/sbin:/opt/git/current/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin'
function nginx_start() {
sudo /opt/nginx/sbin/nginx
}
function nginx_reload() {
worker_processes 1;
pid /opt/nginx/logs/nginx.pid;
events {
worker_connections 1024;
}
http {
passenger_root /opt/gems/gems/passenger-2.2.9;
passenger_ruby /opt/ruby/nginx_wrapper;
#!/bin/bash
WGET_V=1.11.4
RUBY_V=1.8.7-2010.01
RUBY_REL=68719
NGINX_V=0.8.32
GIT_V=1.6.5.5
GIT_USER=dirkkelly
GIT_EMAIL=dk@dirkkelly.com
@dirkkelly
dirkkelly / gist:662624
Created November 4, 2010 15:31
Radiant (Rails) Exporter
desc "Export specific models to yaml"
task :export => :environment do
require 'fileutils'
begin
# Returns only the specified models, unless they're not defined
models = ENV['MODELS'].split(',').map { |m| m.pluralize.classify.constantize }
rescue
# Returns all models minus the subclasses of Page
models = (ActiveRecord::Base.send(:subclasses) - Page.send(:subclasses)).map { |m| m.name.constantize }
end
@dirkkelly
dirkkelly / _simplass.sass
Created December 10, 2010 02:52
A sass cutdown of the css framework mixins
// compass/_support ***************************************
// Usually compass hacks apply to both ie6 & 7 -- set this to false to disable support for both.
$legacy-support-for-ie: true !default
// Setting this to false will result in smaller output, but no support for ie6
$legacy-support-for-ie6: $legacy-support-for-ie !default
// Setting this to false will result in smaller output, but no support for ie7
$legacy-support-for-ie7: $legacy-support-for-ie !default
@dirkkelly
dirkkelly / product_page.rb
Created December 20, 2010 06:25
A product page has a price, line items, orders and customers.
class ProductPage < Page
cattr_accessor :allowed_children
@@allowed_children = [Page,ArchivePage]
layout 'product'
field 'price'
part 'body'
@dirkkelly
dirkkelly / Page.rb
Created December 20, 2010 06:27
overrides the page method missing to attempt to find or update a field
module Shop
module Models
module Page
def self.included(base)
base.class_eval do
# Returns the field with the name passed.
# If a second parameter is passed the field content will be updated
def field(name,*args)
@dirkkelly
dirkkelly / version.rb
Created December 29, 2010 03:44
Using 2.3.x named_scopes for @mariovisic drafting question
class Version
named_scope :drafts, :conditions => { :draft => true }
named_scope :published, :conditions => { :draft => false }
end
Version.drafts # all drafts
Version.published # all published
@dirkkelly
dirkkelly / dynamic form fields
Created January 13, 2011 00:06
setting up dynamic form fields in the radiant-forms-extension
something_awesome:
extension: mail
field:
from: contact[email]
recipients: info@company.com
<form>
<input name="contact[email]" />
</form>