Skip to content

Instantly share code, notes, and snippets.

View moretea's full-sized avatar

Maarten Hoogendoorn moretea

View GitHub Profile
require 'rubygems'
require 'rails'
require 'rbconfig'
require 'rails/script_rails_loader'
require 'rails/ruby_version_check'
Signal.trap("INT") { puts; exit }
module My
module Module
module Is
module Great
def self.included(klass)
klass.class_eval do
before_filter :filter_me
def filter_me
raise "I DO NOT LIKE FAILURES!" if params.has_key? :failure
has_many has_many
Page ----------------> PageTranslation -----------> PagePart
parent_id page_id page_translation_id
position locale title # We might want to rename this to name
path title body
timestamps meta_keywords
show_in_menu meta_description
link_url custom_title
menu_match browser_title
deletable timestamps
def plugins=(next_plugin_names)
next_plugin_names.sort!
current_plugin_names = self.plugins.collect { |p| p.name }.sort!
# Nothing changed? Do nothing
return if current_plugin_names == next_plugin_names
# Add extra plugins, if there are more assigned, compared to before
next_plugin_names.each do |new|
if current_plugin_names.member? new
<body class="wym_iframe page_part_body">
<p>
Welcome to our site. This is just a place holder page while we gather our content.
<img src="[object HTMLParagraphElement]" class="">
</p>
</body>
require "config/environment"
count = Rim.count
Rim.all.each_with_index do |rim, i|
if rim.rim_photo.file?
puts "rim #{i} of #{count} +"
rim.photo = File.open((Rails.root.to_s + '/public' + rim.rim_photo.url).split("?").first)
rim.save
else
puts "rim #{i} of #{count} -"
Partition GB
/ 10
/home 20
swap 10
/vservers/mysql 50
/vservers/production 50
/vservers/mail 50
/vservers/bind 4
#Original:
# if groups | grep -q rvm ; then
# source "/usr/local/lib/rvm"
# fi
# Doesnt work, since
# $ groups => root
# $ groups `whoami` => root : root rvm
#
<VirtualHost *:80>
ServerName main.fr
ServerAlias main.com
ServerAlias sub.main.fr
ServerAlias sub.main.com
DocumentRoot /var/www/html/prod/current/public
</VirtualHost>
#
# i've represented this tree as the array 'tree'.
# A B C F G K
# / \ / \
# D E H J
# /
# I
#
# According to the nested set rules, the following output should be given:
# 1-A-2 3-B-4 5-C-10 11-F-12 13-G-20 21-K-22