Skip to content

Instantly share code, notes, and snippets.

View sporkd's full-sized avatar

Peter Gumeson sporkd

View GitHub Profile
# Shell script for switching between ruby versions
#
# Hat Tip To
# http://www.metaskills.net/2009/1/20/multiruby-the-macports-way-testing-your-rails-apps-with-ruby-1-9
#
chruby () {
v=`ruby -e "puts RUBY_VERSION.split('.')[0,2].join('.')"`
if [ $v = "1.9" ]; then
cv="1.8"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>test</title>
<style type="text/css" media="screen">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>test</title>
<style type="text/css" media="screen">
has_many :tags_taggings, :as => :taggable, :class_name => 'Tagging', :conditions => "taggings.association = 'tags'", :dependent => :destroy
has_many :tags, :class_name => 'Tag', :through => :tags_taggings, :source => :tag
has_many :likes_taggings, :as => :taggable, :class_name => 'Tagging', :conditions => "taggings.association = 'likes'", :dependent => :destroy
has_many :likes, :class_name => 'Tag', :through => :likes_taggings, :source => :tag
define_index do
indexes tags(:name), :as => :tags
indexes likes(:name), :as => :likes
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>popup test</title>
<style type="text/css" media="screen">
require 'htmlentities'
class String
def plain_text
coder = HTMLEntities.new
coder.decode(self).gsub(/<\/?[^>]*>/, '')
end
def html
coder = HTMLEntities.new
sudo aptitude update
sudo aptitude dist-upgrade
sudo aptitude install openssh-server
sudo aptitude install build-essential binutils-doc
sudo aptitude install autoconf flex bison
sudo aptitude install vim
Attempt 1 (require comes first)
---------------------------------
### lib/html5-boilerplate.rb ###
require File.join(File.dirname(__FILE__), 'app', 'helpers', 'html5_boilerplate_helper')
Compass::Frameworks.register("html5-boilerplate", :path => "#{File.dirname(__FILE__)}/..")
Stack Trace:
/Users/peter/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': /Users/peter/.rvm/gems/ruby-1.9.2-head@html5/gems/html5-boilerplate-0.1.6/lib/html5-boilerplate.rb:1: syntax error, unexpected tCONSTANT, expecting $end (SyntaxError)
@sporkd
sporkd / mongoid_nested_embeds_many.rb
Created January 23, 2011 08:51
Explains how mongoid embeds_many is breaking when nesting more than 1 level deep
class Author
include Mongoid::Document
field :name, :type => String
embeds_many :posts
end
class Post
include Mongoid::Document
field :title, :type => String
embedded_in :author
@sporkd
sporkd / ruby-debugger-install.sh
Created March 7, 2011 03:34
How to install ruby debugger on rvm
gem install ruby-debug19 -- --with-ruby-include=/Users/peter/.rvm/src/ruby-1.9.2-head/