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
#!/bin/bash | |
# | |
# load.sh | |
# | |
# script to create a repository and load a dumpfile | |
# | |
SVNADMIN=/usr/local/bin/svnadmin | |
REPO_DIR=/var/svn/repos |
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
#!/bin/bash | |
if [ $# -ne 1 ]; then | |
script=`basename $0` | |
echo "usage: ./${script} repository_name" | |
echo "Creates a new directory and initializes a new git svn repository." | |
exit 1 | |
fi | |
repo=$1 | |
dir=`basename ${repo}` | |
mkdir ${dir} && cd ${dir} && git svn init -s ${repo} && git svn fetch && if [ -e config/database.example.yml ]; then cp config/database.example.yml config/database.yml; fi && mate . && mate config/database.yml |
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 'redcloth/textile_doc' | |
module RedCloth | |
class TextileDoc | |
def initialize( string, restrictions = [:no_span_caps] ) | |
restrictions.each { |r| method("#{r}=").call( true ) } | |
super( string ) | |
end | |
end | |
end |
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
#!/bin/bash | |
# | |
# Depending on your system (and your user's tendencies to | |
# upload files with non-ascii characters), you may wish to set the | |
# default locale language to en_US.UTF-8. | |
# | |
# set system-wide on a centos box (with a stock i18n file): | |
# sed -i -e 's/^#\(LANG="en_US.UTF-8"\)$/\1/' -e 's/^\(LANG="C"\)/#\1/' /etc/sysconfig/i18n | |
# |
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
#!/usr/local/bin/ruby | |
# Create/Load Pages from a text-based outline of titles. | |
# create this script in the root of your app | |
# otherwise, change the path to config/environment. | |
ENV["RAILS_ENV"] ||= 'development' | |
require File.dirname(__FILE__) + '/config/environment' | |
page_part_titles = Page.respond_to?(:default_page_parts) ? Page.default_page_parts : ['body','side_body'] |
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
[Image,NewsItem,Page,Resource].each { |klass| klass.all.each {|e| e.add_to_index } } |
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
# Method 1: add an after filter to set the variable, use it in the application layout | |
PageController.class_eval do | |
after_filter :set_header_quote, :only => [:show] | |
private :set_header_quote | |
def set_header_quote | |
@header_quote = 'Some header quote' | |
end | |
end |
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
# port of http://www.perlmonks.org/?node_id=162190 | |
# | |
# Please refactor this if necessary | |
# leonb -at- beriedata -dot- nl | |
# | |
class String | |
def yoda | |
word = %w{is be will show do try are teach have look help see can learn has}.select { |word| self =~ /\b#{word}\b/ }[0] | |
if word | |
x = (self =~ /\b#{word}\b/) + word.size |
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 AddSmallAndLargeThumbnailSizes < ActiveRecord::Migration | |
# added inline RefinerySetting class | |
class RefinerySetting < ActiveRecord::Base | |
serialize :value # stores into YAML format | |
def self.find_or_set(name, the_value, options={}) | |
# if the database is not up to date yet then it won't know about scoping.. | |
if self.column_names.include?('scoping') | |
options = {:scoping => nil}.merge(options) | |
find_or_create_by_name_and_scoping(:name => name.to_s, :value => the_value, :scoping => options[:scoping]).value | |
else |
NewerOlder