Skip to content

Instantly share code, notes, and snippets.

View johan--'s full-sized avatar

johan pretorius johan--

View GitHub Profile
=== Epic Snow Leopard Upgrayyyyd Guide ===
Son, you’re now living in the land of 64-bit systems.
That means that some of your 32-bit shit is now broken.
Not all is lost.
== Fixing MySQL weirdness
# Ruby on Rails Developer, Berlin/Potsdam
describe "Job: Ruby on Rails Developer(m/f)" do
before do
we = Company.new(
:name => 'adva Business Software GmbH',
:website => 'http://adva-business.com',
:email => 'info@adva-business.com'
)
you = Developer.new
job = Job.new(we, you, :title => "Ruby on Rails Developer", :location => "Berlin/Potsdam")

Basics

The method page will create a new page: page "home" do "Hello, world!" end Save it as any Ruby file (*.rb), then run scratch.rb and point a browser to http://localhost:8000/home to see the result

Arguments can be added (with a given prompt):

One other cause is your :dependent callbacks.
class Blog < AR::Base
has_many :posts, :dependent => :destroy
end
This will iterate through every post and call #destroy on it. Use :delete_all if you want to just issue a single delete query. HOWEVER, this won't hit your destroy callbacks on Post.
class Blog < AR::Base
has_many :posts
Rails CMS alternatives
======================
Active projects:
---------------
adva-cms
repo: http://github.com/svenfuchs/adva_cms/
site: http://adva-cms.org/
Last update: 11/24/09
"the cutting edge Rails CMS platform"
=begin
Note that assert{ 2.0 }'s assert_xhtml (and .be_html_with) now supersede this Gist! Get them with
gem install nokogiri assert2
require 'assert2/xhtml'
And see: http://groups.google.com/group/merb/browse_thread/thread/3588d3f75fa0e65c
----8<---------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Temporary Workaround Concept for Facebook Bug 10005</title>
<!--
Temporary workaround concept for Facebook Bug 10005
http://bugs.developers.facebook.com/show_bug.cgi?id=10005
From your friends at http://awe.sm/
-->
@johan--
johan-- / tee.rb
Created July 16, 2010 08:22 — forked from rklemme/tee.rb
#!/usr/bin/env ruby19
require 'optparse'
# Report erros that are caused by invoking a method when
# an instance is not in the proper state to do so.
class StateError < Exception
end
# Instances of class Tee can send output to several destinations
class ApplicationController < ActionController::Base
include TwitterAuth::Helpers
helper :all
protect_from_forgery
rescue_from Twitter::Unauthorized, :with => :force_sign_in
private
def force_sign_in(exception)
#----------------------------------------------------------------------------
# Git Setup
#----------------------------------------------------------------------------
file '.gitignore', <<-FILE
.DS_Store
log/*.log
tmp/**/*
config/database.yml
db/*.sqlite3
public/uploads/*