Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

# sample 1:
a = 5
a ||= 3
a
#result:
5
# same as:
GET
POST
PUT
UPDATE
DELETE
Recursos:
productos,
compras,
def foo(a, *b, **c)
[a, b, c]
end
puts foo(10, 123, 12, 4, 6, clave: 'hola', nueva: 'asdfads').inspect
# This example is going to show you how to use different versions of rails with a specific version of ruby
# 1. Select your ruby version
rvm use 2.5.1
# 2. Create a gemset for your specific version of rails. The basic approach is to use one gemset per project.
rvm gemset create my_project_in_rails_4
# 3. Check that your gemset was created with:
rvm gemset list
# 4. Select your gemset with:
rvm gemset use my_project_in_rails_4
# 5. Install your specific vesrion of rails. In this case 4
version: '2'
services:
node:
build:
context: .
dockerfile: node.dockerfile
ports:
- "3000:3000"
def stars(n)
n.times {print"*"}
end
stars(5)
puts "\n"
stars(3)
def string_rev_4(word)
if word.length < 4
word.reverse
else
word
end
end
puts string_rev_4('hello')
puts string_rev_4('yo')
puts "Hey, user are you in a good mood? "
until gets.chomp == 'y'
puts "Well, You're fabulous. Are you in a good mood now?"
end
puts "I knew I could cheer you up"
puts "Hey, user are you in a good mood? "
user_mood = gets.chomp
until user_mood == 'y'
puts "Well, You're fabulous. Are you in a good mood now?"
user_mood = gets.chomp
end
puts "I knew I could cheer you up"
@EmanuelCadems
EmanuelCadems / clean_branches.sh
Created April 7, 2017 17:01
Delete many branches at the same time
# How to delete many branches at the same time
# This will delete all branches already merged that start with release follow by anything
git branch -d `git branch | grep -E 'release*'`