This file contains hidden or 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
| create_table(:pairs) do | |
| primary_key :id | |
| foreign_key :left_leaf_id, :leafs, :key => :id | |
| foreign_key :right_leaf_id, :leafs, :key => :id | |
| String :description | |
| FalseClass :enabled | |
| Time :created_at, :null => false, :index => true |
This file contains hidden or 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
| create_table(:pairs) do | |
| primary_key :id | |
| foreign_key :left_leaf_id, :leafs, :key => :id | |
| foreign_key :right_leaf_id, :leafs, :key => :id | |
| String :description | |
| FalseClass :enabled | |
| Time :created_at, :null => false, :index => true |
This file contains hidden or 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 Car | |
| attr_accessor :brand, :year, :model | |
| def initialize(brand=nil, year=nil, model=nil) | |
| @brand = brand | |
| @year = year | |
| @model = model | |
| end | |
| end |
This file contains hidden or 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
| tmp | |
| log | |
| doc | |
| daemon | |
| *.swp |
This file contains hidden or 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 'benchmark' | |
| n = 10_000_000 | |
| Benchmark.bm(24) do |b| | |
| 5.times do | |
| b.report('double-quotes with \t') { n.times { "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" } } | |
| b.report('double-quotes with <tab>') { n.times { " " } } | |
| b.report('single-quotes with <tab>') { n.times { ' ' } } | |
| end |
This file contains hidden or 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
| [gferguson@s2tlnetlab001 src]$ rvm install 1.9.2-p0 --trace | |
| 1.9.2-p0 --trace | |
| rvm 1.1.12 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/] | |
| + [[ -z '' ]] | |
| + export 'PS4=+[${BASH_SOURCE}] : ${LINENO} : ${FUNCNAME[0]:+${FUNCNAME[0]}() $ }' | |
| + PS4='+[${BASH_SOURCE}] : ${LINENO} : ${FUNCNAME[0]:+${FUNCNAME[0]}() $ }' | |
| +[/home/gferguson/.rvm/scripts/cli] : 597 : __rvm_parse_args() $ [[ -z install ]] | |
| +[/home/gferguson/.rvm/scripts/cli] : 599 : __rvm_parse_args() $ [[ 0 -eq 1 ]] |
This file contains hidden or 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
| # USAGE: Hash.from_xml:(YOUR_XML_STRING) | |
| require 'nokogiri' | |
| # modified from http://stackoverflow.com/questions/1230741/convert-a-nokogiri-document-to-a-ruby-hash/1231297#1231297 | |
| class Hash | |
| class << self | |
| def from_xml(xml_io) | |
| begin | |
| result = Nokogiri::XML(xml_io) | |
| return { result.root.name.to_sym => xml_node_to_hash(result.root)} |
This file contains hidden or 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 Dungeon | |
| @@levels = [] | |
| def add_level(n, h, w) | |
| @@levels[n] = Level.new(h, w) | |
| end | |
| end | |
| class Level | |
| def initialize(height, width) | |
| @height, @width = height, width |
This file contains hidden or 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
| # | |
| # at the bottom of the trace it says... | |
| # | |
| raise exc.DBAPIError.instance(statement, parameters, e, connection_invalidated=is_disconnect) | |
| sqlalchemy.exc.ProgrammingError: (ProgrammingError) can't adapt 'SELECT count(1) AS count_1 \nFROM blogfeeds \nWHERE blogfeeds.blog_url ILIKE %(blog_url_1)s' {'blog_url_1': 'http://seanmalstrom.wordpress.com/2009/12/21/email-final-fantasy-crystal-chronicles-crystal-bearers/'} | |
| # | |
| # I'm using SqlSoup... | |
| # | |
| from sqlalchemy.ext.sqlsoup import SqlSoup |