This file contains hidden or 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
| inputs = %w[ | |
| CollectionSelectInput | |
| DateTimeInput | |
| FileInput | |
| GroupedCollectionSelectInput | |
| NumericInput | |
| PasswordInput | |
| RangeInput | |
| StringInput | |
| TextInput |
This file contains hidden or 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
| .img-wrap { | |
| position: relative; | |
| ... | |
| } | |
| .img-wrap .close { | |
| position: absolute; | |
| top: 2px; | |
| right: 2px; | |
| z-index: 100; | |
| ... |
This file contains hidden or 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
| # sample config/initializers/carrierwave.rb | |
| CarrierWave.configure do |config| | |
| if Rails.env.development? || Rails.env.test? | |
| config.storage = :file | |
| else | |
| config.storage = :fog | |
| config.fog_credentials = { | |
| provider: "AWS", | |
| aws_access_key_id: ENV["AWS_ACCESS_KEY_ID"], | |
| aws_secret_access_key: ENV["AWS_SECRET_ACCESS_KEY"] |
This file contains hidden or 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
| .keyboard 'name', -> | |
| restrict: 'E', | |
| replace: true, | |
| templateUrl: '/partials/keyboard.html', | |
| scope: | |
| section: "@" | |
| controller: ($scope, $element) -> | |
This file contains hidden or 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
| validate :password_complexity | |
| def password_complexity | |
| if password.present? and not password.match(/(?=.*\d)(?=.*[a-z])(?=.*[A-Z])/) | |
| errors.add :password, "debe incluir almenos una letra mayuscula, una miniscula y un numero" | |
| end | |
| end |
This file contains hidden or 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
| at least one digit | |
| at least one lowercase | |
| at least one uppercase | |
| at least one special character | |
| regex = /(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[ ! @ # $ % ^ & * ( ) _ - + =])/ | |
| regex.test(req.body.password) |
This file contains hidden or 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
| function shuffle(o){ | |
| for(var j, x, i = o.length; i; j = Math.floor(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x); | |
| return o; | |
| }; |
This file contains hidden or 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
| =Navigating= | |
| visit('/projects') | |
| visit(post_comments_path(post)) | |
| =Clicking links and buttons= | |
| click_link('id-of-link') | |
| click_link('Link Text') | |
| click_button('Save') | |
| click('Link Text') # Click either a link or a button | |
| click('Button Value') |
This file contains hidden or 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 Person | |
| def self.new(name) | |
| @cache ||= {} | |
| @cache[name] ||= super(name) | |
| end | |
| def initialize(name) | |
| @name = name | |
| end | |
| end |
This file contains hidden or 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
| require 'rbconfig' | |
| def os | |
| @os ||= ( | |
| host_os = RbConfig::CONFIG['host_os'] | |
| case host_os | |
| when /mswin|msys|mingw|cygwin|bccwin|wince|emc/ | |
| :windows | |
| when /darwin|mac os/ | |
| :macosx |