azinazadi azinazadi

View nonlinear-scroll.coffee
1 2 3 4 5 6 7 8 9 10
# nonlinear scrolling of idea attachments
# we want to make it like the scrolling pauses on each attachment
# for this we create an empty wrapper with the same width, height and use a fixed positioning for attachments container
# this way we can freely decide where to position them based on window's scroll position, and the wrapper will keep the
# preserved space in the document
 
$(window).on 'scroll', ->
container = $('.nonlinear-scroll')
wrapper = $('.nonlinear-scroll-wrapper')
breathePoints = $('.nonlinear-scroll-breathe-point')
View fui_boolean_input.rb
1 2 3 4 5 6
class FuiBooleanInput < SimpleForm::Inputs::BooleanInput
self.default_options = {:input_html => {'data-toggle' => "checkbox"}, :inline_label => true, :label => false}
def nested_boolean_style?
true
end
end
View 0_selector_hacks.scss
1 2 3 4 5 6
@mixin ie6 { * html & { @content } }
 
#logo {
background-image: url("/images/logo.png");
@include ie6 { background-image: url("/images/logo.gif"); }
}
View rails_cheatsheet.md

An incomplete cheatsheet for rails 3. Things are added as they are required.

Active Record validations

# http://guides.rubyonrails.org/active_record_validations_callbacks.html

class SomeClass < ActiveRecord::Base

  # length
View formtastic.rb
1 2 3 4 5 6 7 8 9 10
more: https://github.com/justinfrench/formtastic
 
-> make form for all db columns
<%= semantic_form_for @user do |f| %>
<%= f.inputs %>
<%= f.buttons %>
<% end %>
 
-> select cols
<%= semantic_form_for @user do |f| %>
View all.rb
1 2 3 4 5 6 7 8 9 10
'
rails 1.9 new hash syntax
new_hash = {simon: "Talek", lorem: "Ipsum"}
 
###Rspec
%cucumber
save_and_open_page
 
 
###MIGRATION
View squeel
1 2 3 4 5 6 7 8 9 10
http://erniemiller.org/projects/squeel/
 
* KeyPaths
Person.joins(:articles => {:comments => :person}) => Person.joins(articles.comments.person)
-> they can also exist in the context of a hash
 
* Predicates
 
SQL Predication Operator Alias
= eq ==
Something went wrong with that request. Please try again.