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 "sequel" | |
DB = Sequel.postgres("arel") | |
DB.create_table!(:movies) { primary_key :id } | |
class Movie < Sequel::Model | |
end | |
# Asterisk (I agree this one isn't ideal) | |
Movie.select{count{}.*} # SELECT count(*) FROM "movies" |
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 "active_record" | |
ActiveRecord::Base.establish_connection('postgres:///testing') | |
ActiveRecord::Migration.verbose = false | |
ActiveRecord::Migration.class_eval do | |
create_table :played_quizzes, force: true do |t| | |
t.integer :player_ids, array: true | |
t.json :quiz_snapshot | |
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
require 'ramaze' | |
class Main < Ramaze::Controller | |
def index | |
make_static | |
end | |
private | |
def make_static |
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
layout do |path, wish| | |
if path !~ /feed|show/ | |
mobile_rendering? ? :mobile : :main | |
end | |
end | |
def self.mobile_rendering? | |
(request.host =~ /m\.learnivore/) ? true : false | |
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
require 'rubygems' | |
require 'anemone' | |
require 'builder' | |
sitemap = "" | |
xml = Builder::XmlMarkup.new(:target => sitemap, :indent=>2) | |
xml.instruct! | |
xml.urlset(:xmlns=>'http://www.sitemaps.org/schemas/sitemap/0.9') { | |
Anemone.crawl("http://www.example.com/", :discard_page_bodies => true) do |anemone| |