View SassMeister-input.sass
// ----
// Sass (v3.4.7)
// Compass (v1.0.1)
// ----
.selector
@media screen and (min-width: 1024px)
&.-of-5
width: 20%
View patch.rb
def validator_relevant?(validator)
return true unless validator.options.key?(:if) || validator.options.key?(:unless)
conditional = validator.options.key?(:if) ? validator.options[:if] : validator.options[:unless]
result = if conditional.respond_to?(:call)
object.instance_exec(&conditional)
elsif conditional.is_a?(::Symbol) && object.respond_to?(conditional)
object.send(conditional)
else
conditional
View omg.rb
class NonActiveRecordModel
def initialize(relation)
@relation = relation
end
def do_stuff
@relation.some_association.where(...)
end
end
View rails_server.sh
function s()
{
# Look for a .env file, run foreman with -p 3000 for consistency
if [ -e ".env" ]
then
foreman start -p 3000
# Look for "script/rails" (Rails 3)
elif [ -e "script/rails" ]
then
script/rails server
View whatevers.css.scss
@import "twitter/bootstrap";
.whatever {
@extend .well;
}
View .gitconfig
[alias]
current-branch = !git branch | grep '^*' | sed s/\\*\\ //
track = !git branch --set-upstream $(git current-branch) origin/$(git current-branch)
publish = !git push origin $(git current-branch) && echo $(git track)
View gist:2362758
# Expected h1 title for posts#show is "My Blog :: My Post Title"
# --------------------------------------------------------------
# This was how it worked with `layout nil` in the controller
#
# posts_controller.rb
class PostsController
layout nil
View gist:1777140
.something {
rules for older browsers like IE6–8
}
.something:not(.crappy) {
extra rules for any browser that supports :not selector
the .crappy class is a hack, but it feels appropriate
}
View gist:1727546
# PRODUCT MODEL
has_many :product_people
has_many :people, :through => :product_people
accepts_nested_attributes_for :people
<%= f.inputs "Cast" do %>
<%= f.inputs :for => :people do |p| %>
<%= p.input :name %>
<%= p.input :_destroy, :as => :boolean %>
View .gitconfig
[alias]
current-branch = !git branch | grep '^*' | sed s/\\*\\ //
track = !git branch --set-upstream $(git current-branch) origin/$(git current-branch)
publish = !git push origin $(git current-branch) && echo $(git track)