This file contains 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
# | |
# Put this somwehere in your `spec/support` folder, then you can do something like that | |
# | |
# feature "Stuff" do | |
# feature 'new' do | |
# scenario 'user goes in and gets awesomized' do | |
# end | |
# | |
# scenario 'user goes in with evil intentions and doesn't get awesomized' do | |
# end |
This file contains 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
# | |
# Save this into your `lib/mongoid/paperclip.rb` file | |
# | |
# | |
require "paperclip" | |
module Paperclip | |
class << self |
This file contains 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
data: function() { | |
return { | |
trend : this.model.trend, | |
subtrend : this.model, | |
next_subtrend : this.model.nextSubtrend(), | |
next_trend : this.model.trend.nextTrend() | |
}; | |
} |
This file contains 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
a.add, a.edit, a.delete | |
&:before | |
margin-right: .25em | |
a.add:before | |
content: "\271A" | |
a.edit:before | |
content: "\270E" |
This file contains 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
// This way you can change the buttons color with a simple `background-color` setting | |
// without need to regenerate the whole gradient | |
input[type=button], input[type=submit], button | |
font-family: Arial, Helvetica | |
color: #333 | |
border: 1px solid #ccc | |
border-radius: .25em | |
text-shadow: 0 1px 1px rgba(0,0,0,.3) |
This file contains 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
# | |
# Save this in `lib/mongoid/counter_cache.rb` | |
# | |
# Then define your relations kinda like that | |
# | |
# class Comment | |
# belongs_to :post, counter_cache: true # 'comments_count' | |
# belongs_to :user, counter_cache: 'my_field_name' | |
# end | |
# |
This file contains 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
# | |
# Making BCrypt to use minimal cost so that the specs run faster | |
# | |
# place this in the spec/support/bcrypt.rb file | |
# | |
require 'bcrypt' | |
module BCrypt | |
class Engine | |
class << self |
This file contains 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
# | |
# RJS handler was kicked out of Rails 3.1 along with Prototype | |
# so, here is a little substitute coz we use it here and there | |
# | |
# Just save it in some file in the `config/initializers` | |
# | |
module ActionView | |
module Template::Handlers | |
class RJS | |
# Default format used by RJS. |
This file contains 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
# | |
# Recursively converts an object into a query string | |
# | |
to_query_string = (data)-> | |
map = (hash, prefix='')-> | |
result = [] | |
for key, value of hash | |
key = if prefix is '' then key else "#{prefix}[#{key}]" |
This file contains 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
/** | |
* Cubic Bezier CSS3 transitions emulator | |
* | |
* See this post for more details | |
* http://st-on-it.blogspot.com/2011/05/calculating-cubic-bezier-function.html | |
* | |
* Copyright (C) 2011 Nikolay Nemshilov | |
*/ | |
function Bezier(p1,p2,p3,p4) { | |
// defining the bezier functions in the polynomial form |