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
require_relative "echo" | |
require "minitest/autorun" | |
require 'securerandom' | |
class TestEcho < Minitest::Test | |
def setup | |
@echo = Echo.new | |
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
require_relative "echo" | |
require "minitest/autorun" | |
require 'securerandom' | |
class TestEcho < Minitest::Test | |
def setup | |
@echo = Echo.new | |
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
require_relative "echo" | |
require "minitest/autorun" | |
class TestEcho < Minitest::Test | |
def setup | |
@echo = Echo.new | |
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
#!/bin/bash | |
# Rails new utility | |
# Usage: rails_new ruby_version rails_version | |
echo "$1" > .ruby-version | |
echo "source 'https://rubygems.org'" > Gemfile | |
echo "gem 'rails', '$2'" >> Gemfile | |
bundle install | |
bundle exec rails new . --force --skip-bundle --skip-active-record |
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
eval "$(rbenv init -)" | |
source ~/.git-completion.bash | |
alias gh='git checkout' | |
alias gl='git log --decorate=full' | |
alias g='git status' | |
alias gc='git commit' | |
alias be='bundle exec' | |
alias s='ssh' |
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
#!/bin/bash | |
if [ -f "Capfile" ] | |
then | |
if [ "$1" = "parriba" ] | |
then | |
env='production' | |
else | |
env='staging' | |
fi |
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
# Add the following lines at the end of config/deploy.rb | |
Dir["config/deploy/extras/*.rb"].each { |file| load file } | |
set :notify_emails, ["[email protected]"] | |
after "deploy", "deploy:notify" |
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
provinces = { | |
1 => "Álava", | |
2 => "Albacete", | |
3 => "Alicante", | |
4 => "Almería", | |
33 => "Asturias", | |
5 => "Ávila", | |
6 => "Badajoz", | |
7 => "Illes Balears", | |
8 => "Barcelona", |
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
var crypto = require("crypto"); | |
var moment = require("moment") | |
var s3 = { | |
generateS3Policy: function (fileName) { | |
var s3Policy = { | |
'conditions': [ | |
{'bucket': CONF.s3.bucket}, | |
['starts-with', '$key', 'uploads/' + fileName], | |
{'acl': 'public-read'}, |
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
# encoding: UTF-8 | |
class String | |
def singularize_es | |
if self[-2..-1].index(/es/) # Ending in 'es' | |
if self[-4..-1].index(/[^aeiou][^aeiou]es/) # Ending in consonant + consonant + 'es': remove 's' ('coche' > 'coches') | |
self[0..-2] | |
else | |
if self[-3..-1].index(/[^aeiou]es/) # Ending in consonant + 'es' | |
case self[-3..-1] |