Skip to content

Instantly share code, notes, and snippets.

View edymerchk's full-sized avatar
:shipit:
Shipping

Edy Laverde edymerchk

:shipit:
Shipping
  • Medellin
View GitHub Profile
inputs = %w[
CollectionSelectInput
DateTimeInput
FileInput
GroupedCollectionSelectInput
NumericInput
PasswordInput
RangeInput
StringInput
TextInput
.img-wrap {
position: relative;
...
}
.img-wrap .close {
position: absolute;
top: 2px;
right: 2px;
z-index: 100;
...
@edymerchk
edymerchk / carrierwave.rb
Created April 12, 2014 18:53
carrierwave setup
# 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"]
.keyboard 'name', ->
restrict: 'E',
replace: true,
templateUrl: '/partials/keyboard.html',
scope:
section: "@"
controller: ($scope, $element) ->
@edymerchk
edymerchk / user.rb
Created April 17, 2014 22:48
password_complexity
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
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)
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;
};
=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')
class Person
def self.new(name)
@cache ||= {}
@cache[name] ||= super(name)
end
def initialize(name)
@name = name
end
end
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