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
ru: | |
activerecord: | |
theme/posts: | |
text: Содержание # theme[posts][text] |
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
RSpec.configure do |config| | |
config.after(:each) do | |
if example.exception && example.metadata[:js] | |
meta = example.metadata | |
filename = File.basename(meta[:file_path]) | |
line_number = meta[:line_number] | |
screenshot_name = "screenshot-#{filename}-#{line_number}.png" | |
screenshot_path = "#{Rails.root.join("tmp")}/#{screenshot_name}" | |
page.save_screenshot(screenshot_path) |
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
// outside the scope of the jQuery plugin to | |
// keep track of all dropdowns | |
var $allDropdowns = $(); | |
// if instantlyCloseOthers is true, then it will instantly | |
// shut other nav items when a new one is hovered over | |
$.fn.dropdownHover = function(options) { | |
// the element we really care about | |
// is the dropdown-toggle's parent |
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
def filename | |
if original_filename | |
if model && model.read_attribute(mounted_as).present? | |
model.read_attribute(mounted_as) | |
else | |
"#{SecureRandom.hex}.#{File.extname(file.filename)}" | |
end | |
end | |
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
# This is a skeleton for testing models including examples of validations, callbacks, | |
# scopes, instance & class methods, associations, and more. | |
# Pick and choose what you want, as all models don't NEED to be tested at this depth. | |
# | |
# I'm always eager to hear new tips & suggestions as I'm still new to testing, | |
# so if you have any, please share! | |
# | |
# @kyletcarlson | |
# | |
# This skeleton also assumes you're using the following gems: |
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
$.fn.serializeObject = function() | |
{ | |
var o = {}; | |
var a = this.serializeArray(); | |
$.each(a, function() { | |
if (o[this.name] !== undefined) { | |
if (!o[this.name].push) { | |
o[this.name] = [o[this.name]]; | |
} | |
o[this.name].push(this.value || ''); |
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
mkdir ~/bin | |
export PATH=~/bin:$PATH | |
ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl | |
export EDITOR='subl -w' | |
git config --global core.editor "subl -n -w" |
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
desc "Copy paperclip data" | |
task :copy_paperclip_data => :environment do | |
@users = User.find :all | |
@users.each do |user| | |
unless user.image_file_name.blank? | |
filename = Rails.root.join('public', 'system', 'images', user.id.to_s, 'original', user.image_file_name) | |
if File.exists? filename | |
image = File.new filename | |
user.image = image |
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
.file_upload { | |
position: relative; | |
overflow: hidden; | |
float: left; | |
margin-right: 4px; | |
} | |
.file_upload input { | |
position: absolute; | |
top: 0; | |
right: 0; |
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
# Rails3 way to redirect non-www domain to www domain | |
# Single domain redirect | |
'example.com'.tap do |host| | |
constraints(:host => host) do | |
match '/(*path)', :to => redirect { |params, request| Addressable::URI.escape request.url.sub(host, "www.#{host}") } | |
end | |
end | |
OlderNewer