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
# RegEx: is from http://stackoverflow.com/a/13311941/632478 | |
# Rubular: http://rubular.com/r/cdkLxAkTbk | |
validates :url, format: { with: /^(http|https):\/\/|[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,6}(:[0-9]{1,5})?(\/.*)?$/ix } |
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
# Configs | |
config defaultToCurrentScreen true | |
config nudgePercentOf screenSize | |
config resizePercentOf screenSize | |
config secondsBetweenRepeat 0.1 | |
config checkDefaultsOnLoad true | |
config focusCheckWidthMax 3000 | |
config windowHintsShowIcons true | |
config windowHintsIgnoreHiddenWindows false | |
#config windowHintsDuration 5 |
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
E, [2013-11-24T08:23:48.282063 #20438] ERROR -- : reaped #<Process::Status: pid 29427 exit 1> worker=1 | |
I, [2013-11-24T08:23:48.282426 #20438] INFO -- : worker=1 spawning... | |
I, [2013-11-24T08:23:48.283720 #29440] INFO -- : worker=1 spawned pid=29440 | |
I, [2013-11-24T08:23:48.301879 #29440] INFO -- : Refreshing Gem list | |
E, [2013-11-24T08:23:48.343457 #29430] ERROR -- : couldn't find HOME environment -- expanding `~' (ArgumentError) | |
/usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/gems/1.9.1/gems/guard-1.8.3/lib/guard.rb:23:in `expand_path' | |
/usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/gems/1.9.1/gems/guard-1.8.3/lib/guard.rb:23:in `<module:Guard>' | |
/usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/gems/1.9.1/gems/guard-1.8.3/lib/guard.rb:8:in `<top (required)>' | |
/usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require' | |
/usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require' |
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
class ApplicationController < ActionController::Base | |
def after_sign_in_path_for(resource) | |
request.env['omniauth.origin'] || stored_location_for(resource) || root_path | |
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
secrets = Rails.application.secrets | |
config.paperclip_defaults = { | |
storage: :s3, | |
s3_credentials: { | |
bucket: secrets.amazon_bucket_name, | |
access_key_id: secrets.amazon_access_key_id, | |
secret_access_key: secrets.amazon_secret_access_key, | |
s3_region: "eu-central-1" | |
} | |
} |
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
# config/initializers/paperclip.rb | |
Paperclip::Attachment.default_options[:s3_host_name] = 's3.eu-central-1.amazonaws.com' |
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
document.addEventListener("turbolinks:load", function() { | |
$('.selectize').selectize() | |
}) | |
document.addEventListener('turbolinks:before-cache', function(){ | |
$('.selectize').each(function(){ | |
if (this.selectize != undefined) { | |
this.selectize.destroy() | |
} | |
}) |
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
# test/helpers/title_helper_test.rb | |
require 'test_helper' | |
class TitleHelperTest < ActionView::TestCase | |
test "return title with controller name when title content is nil" do | |
stub :controller_name, 'businesses' do | |
result = set_title_tag title_content: nil, from_layout: 'Admin Area' | |
assert_equal 'Clienti - Admin Area - iPY', result | |
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
<select type="text" | |
class="form-control" | |
v-model="momento.project" | |
name="project_id"> | |
<option v-for="project in projects" | |
v-bind:value="{name: project.name, id: project.id}"> | |
{{ project.name }} | |
</option> | |
</select> |
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
businesses = Business.select{ |business| check_data_presence_for(business)} | |
previous_count = BusinessArea::RegisteredOffice.count | |
count = businesses.count.to_s | |
count_digits = count.length | |
cursors = ['|', '/', '-', '\\', '|', '/', '-', '\\'] | |
businesses.each.with_index(1) do |business, index| | |
cursor = cursors[index % 32 / 4] | |
formatted_index = index.to_s.rjust(count_digits, '0') | |
print "#{cursor} #{formatted_index}/#{count} (business #{business.id}) #{cursor}" | |
params = extract_params_from(business) |