Skip to content

Instantly share code, notes, and snippets.

View neotericdesign's full-sized avatar

Neoteric Design, Inc. neotericdesign

View GitHub Profile
@neotericdesign
neotericdesign / page_extensions.rb
Created November 16, 2010 16:25
this worked in Rails2 RefineryCMS -- in the initializers folder
class Page
acts_as_commentable
has_many :page_widget_assignments
has_many :assigned_widgets, :through => :page_widget_assignments, :source => :widget
def widgets
if assigned_widgets.blank?
parent_id? ? parent.widgets : Widget.system
else
# $: rails g migration AddImageIdToPages image_id:integer
# produces:
class AddImageIdToPages < ActiveRecord::Migration
def self.up
add_column :pages, :image_id, :integer
end
def self.down
remove_column :pages, :image_id
end
> e = Event.first
=> #<Event id: 3, title: "GULAG Art", start_at: "2010-10-01 09:00:00", end_at: "2010-12-31 23:59:00", registration_link: "", description: "<p><strong>Through December 2010</strong>\r\n</p>\r\n<p...", thumbnail_id: 16, venue_name: "The Joseph Regenstein Library", venue_address: "1100 East 57th Street, 2nd Floor Reading Room Chica...", venue_url: "http://lib.uchicago.edu", venue_phone: "", is_featured: false, presenter_id: 28, position: 2, created_at: "2010-10-20 21:20:58", updated_at: "2010-11-03 17:06:14", lat: #<BigDecimal:1051e6dc8,'0.9999999999E0',18(27)>, lng: #<BigDecimal:1051e6d00,'-0.9999999999E0',18(27)>>
ruby-1.8.7-p302 > include Geokit::Geocoders
=> Object
ruby-1.8.7-p302 > res=MultiGeocoder.geocode(e.venue_address)
=> #<Geokit::GeoLoc:0x10510dac8 @lng=-87.6297982, @full_address="Chicago, IL, USA", @suggested_bounds=#<Geokit::Bounds:0x1050588f8 @sw=#<Geokit::LatLng:0x105058830 @lng=-87.885917, @lat=41.7450495>, @ne=#<Geokit::LatLng:0x105058768 @lng=-87.3736794, @lat=42.0109012
/* thank you, Compass, for turning this: */
#example{
@include transition;
}
/* into this: */
#example{
-moz-transition-property: all;
-webkit-transition-property: all;
<div id="flash_container">
<noscript>
&lt;div class='flash flash_error'&gt;
For full functionality of this page it is necessary to enable JavaScript.
Here are the
&lt;a href="http://www.enable-javascript.com" target="_blank"&gt;instructions how to enable JavaScript in your web browser&lt;/a&gt;
&lt;/div&gt;
</noscript>
Started GET "/experience/courses/calendar?second_half=true" for 127.0.0.1 at Wed Oct 20 17:05:41 -0500 2010
Processing by CoursesController#calendar as HTML
Parameters: {"locale"=>:en, "second_half"=>"true"}
RefinerySetting Load (3.0ms) SELECT `refinery_settings`.* FROM `refinery_settings`
SQL (1.7ms) SHOW TABLES
SQL (17.2ms) describe `roles_users`
Role Load (0.5ms) SELECT `roles`.* FROM `roles` WHERE (`roles`.`title` = 'Refinery') LIMIT 1
SQL (1.6ms) SHOW TABLES
SQL (1.7ms) describe `roles_users`
User Load (1.1ms) SELECT * FROM `users` INNER JOIN `roles_users` ON `users`.id = `roles_users`.user_id WHERE (`roles_users`.role_id = 1 )
Started GET "/experience/courses/calendar/" for 127.0.0.1 at Wed Oct 20 16:34:55 -0500 2010
Processing by CoursesController#calendar as HTML
Parameters: {"locale"=>:en}
RefinerySetting Load (3.0ms) SELECT `refinery_settings`.* FROM `refinery_settings`
SQL (1.5ms) SHOW TABLES
SQL (4.5ms) describe `roles_users`
Role Load (0.5ms) SELECT `roles`.* FROM `roles` WHERE (`roles`.`title` = 'Refinery') LIMIT 1
SQL (1.7ms) SHOW TABLES
SQL (1.7ms) describe `roles_users`
User Load (1.2ms) SELECT * FROM `users` INNER JOIN `roles_users` ON `users`.id = `roles_users`.user_id WHERE (`roles_users`.role_id = 1 )
[2010-10-20 15:45:08] ERROR LoadError: Expected /Users/joe/.rvm/gems/ruby-1.8.7-p302@rails3/gems/refinerycms-theming-0.9.8.1/app/models/theme.rb to define Theme
/Users/joe/.rvm/gems/ruby-1.8.7-p302@rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:492:in `load_missing_constant'
/Users/joe/.rvm/gems/ruby-1.8.7-p302@rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:183:in `const_missing'
/Users/joe/.rvm/gems/ruby-1.8.7-p302@rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:181:in `each'
/Users/joe/.rvm/gems/ruby-1.8.7-p302@rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:181:in `const_missing'
/Users/joe/.rvm/gems/ruby-1.8.7-p302@rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:503:in `load_missing_constant'
/Users/joe/.rvm/gems/ruby-1.8.7-p302@rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:183:in `const_missing'
/Users/joe/.rvm/gems/ruby-1.8.7-p302@rails3/gems/activesupport-3.0.0/lib/active_support
<article class="panel" id="home-pulse">
<header>
<h1>Pulse</h1>
</header>
<section>
<header>
<h1>Q: Reach way back&hellip; What was your first job?</h1>
</header>
<footer>
<img src="/images/productname/headshot.jpg" alt="Persons Name Headshot">
//duh
$(document).ready(function(){
$('#recent-activity').tabs();
});