Skip to content

Instantly share code, notes, and snippets.

@Justinwceo
Justinwceo / system.log.txt
Created October 12, 2012 13:55
HURB mod for Medieval 2 Total War (with SS 6.4) system log error while playing Aragon
20:48:15.109 [system.rpt] [always] CPU: SSE2
20:48:15.109 [system.rpt] [always] ==== system log start, build date: Feb 25 2008 version development ===
20:48:15.113 [system.io] [always] mounted pack packs/data_0.pack
20:48:15.113 [system.io] [always] mounted pack packs/data_1.pack
20:48:15.114 [system.io] [always] mounted pack packs/data_2.pack
20:48:15.115 [system.io] [always] mounted pack packs/data_3.pack
20:48:15.116 [system.io] [always] mounted pack packs/data_4.pack
20:48:15.116 [system.io] [always] mounted pack packs/localized.pack
20:48:18.487 [script.err] [error] Script Error in mods/SS6.3/data/descr_faction_standing.txt, at line 156, column 44
Building level name small_chapel not found as a level in building database
Started POST "/dogs" for 127.0.0.1 at 2012-07-29 20:44:15 -0400
Processing by DogsController#create as JS
Parameters: {"utf8"=>"Γ£ô", "authenticity_token"=>"wuPqA6e8MqF/yW3VQ+sfLiyf0olOWgEpnVC2qawQE0I=", "dog"
Add Dog"}
User Load (2.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
Category Load (0.0ms) SELECT "categories".* FROM "categories" WHERE "categories"."id" IN (1, 2, 3)
(1.0ms) BEGIN
(0.0ms) COMMIT
(0.0ms) BEGIN
(1.0ms) SELECT 1 FROM "categories" WHERE ("categories"."name" = 'furry' AND "categories"."id" != 1) LI
@Justinwceo
Justinwceo / bnew.html.erb
Created March 7, 2012 08:24
Unaligned Simple Form labels with Twitter Bootstrap
<%= simple_form_for(@store, :html => { :class => 'form-horizontal' }) do |f| %>
<%= render :partial => "shared/error_message", :locals => { :f => f } %>
<div class="span12">
<%= f.input :business_name, :label => 'Business', :input_html => { :class => "span3" }, :hint => "The Business the store will belong to" %>
<%= f.input :online_store, :label => 'Online Store', :as => :boolean %>
<%= f.input :address, :input_html => { :class => "span3" }, :placeholder => "451 University Avenue, Palo Alto, CA 94301", :hint => "For offline store" %>
<%= f.input :website, :input_html => { :class => "span3" }, :placeholder => "www.somewebsite.com", :hint => "For online store" %>
<%= f.input :phone_number, :input_html => { :class => "span3" }, :placeholder => "(650) 798-2800" %>
<div class="form-actions">
<%= f.button :submit, "Done", :class => 'btn btn-primary span2' %>
@Justinwceo
Justinwceo / product.rb
Created December 18, 2011 20:22
geocoder
searchable do
string :search_near
location :location do
Sunspot::Util::Coordinates.new(store.latitude, store.longitude) if store
end
end
def search_near
store.address if store
end
@Justinwceo
Justinwceo / _fields.html.erb
Created December 15, 2011 06:55
Rendering error messages for form_tag that creates one model multiple times like form_for?
<%= f.text_field :name %>
<%= f.text_field :price %>
<%= f.text_field :product_store %>
@Justinwceo
Justinwceo / new.html.erb
Created December 13, 2011 15:50
Validations and Adding Products
<%= form_tag create_multiple_products_path, :method => :post do %>
<%= date_select("product", "purchase_date") %> # This acts as a global field for all Products.
<% @products.each_with_index do |product, index| %>
<%= fields_for "products[#{index}]", product do |up| %>
<%= render "fields", :f => up %>
<% end %>
<% end %>
@Justinwceo
Justinwceo / Product.rb
Created November 26, 2011 11:18
Radio buttons and Sunspot
searchable do
text :name
boolean :online_search
boolean :offline_search
end
def online_search
store.online_store == true
end
@Justinwceo
Justinwceo / BusinessStore.rb
Created November 24, 2011 19:02
Checkboxes
class BusinessStore < ActiveRecord::Base
attr_accessible :website, :name, :address, :phone_number, :online_store
has_many :products
end
@Justinwceo
Justinwceo / _form.html.erb
Created August 16, 2011 16:33
Jquery Tokeinput & Dynamic Ruby on Rails Nested Form
<%= form_for(current_user, :url => user_products_path) do |f| %>
<%= f.error_messages %>
<% f.fields_for :user_products do |builder| %>
<%= render "user_product_fields", :f => builder %>
<% end %>
<p>
<%= link_to_add_fields "Additional User Product", f, :user_products %>
</p>
<%= f.submit "Create" %>
<% end %>
@Justinwceo
Justinwceo / mockup.rb
Created August 13, 2011 03:01
Search Products Mock Up
Logo ---------------------------------------------------------- Log Out
------Navigation-----
========================================================================
Search Page
========================================================================
========================================================================
Search for => "Ipad"
Filters: 8/12/11 to Today, Price $5.00 to $700.00 and Lowest to Highest
========================================================================
Found and Filtered 6 Ipad results out of 25