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
# This is for running an irb | |
docker run --it --rm ruby:2.5 | |
# This is for running an script | |
docker run -it --rm --name my-running-script -v "$PWD":/usr/src/myapp -w /usr/src/myapp ruby:2.5 ruby hello_world.rb | |
# this is the content we should put in hello_world.rb Make sure to add the first line | |
# #!/usr/bin/env Ruby | |
# puts Hello World from Dockerfile | |
# we also need to make the script executable | |
chmod u+x hello_world.rb |
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
<template id='productsTemplate'> | |
<ul> | |
<li v-for="product in products"> | |
{{product.name}} {{product.color}} cuesta ${{product.price}} | |
</li> | |
</ul> | |
</template> |
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
ropa = Category.create name: 'Ropa' | |
electro = Category.create name: 'Electronicos' | |
disco = Category.create name: 'Discos' | |
Product.create name: 'Playera Locochona', photo: 'https://pbs.twimg.com/profile_images/561116211258220544/FlICmGnj.jpeg', stock: 12, category_id: ropa.id | |
Product.create name: 'Playera Locochona', photo: 'https://pbs.twimg.com/profile_images/561116211258220544/FlICmGnj.jpeg', stock: 12, category_id: ropa.id |
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.getElementById("btnAgrupar").onclick = enviar; | |
function enviar() | |
{ | |
var token = ''; | |
var arrayOfIds = []; | |
var allInputs = document.getElementsByTagName("input"); | |
for (var i = 0, max = allInputs.length; i < max; i++) |
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
// aqui defino las variables que me pasaste | |
function calcData () { | |
poblationInit = 122823652 // 122´823, 652 | |
newHabitantMx = 25.6 | |
newBirthMx = 14.5 | |
deathMexican = 44.15 | |
dayInit = '01/01/2017' | |
today = new Date() | |
todayMom = moment(today) // aqui uso la variable today para traer la hora/fecha actual |
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
import cherrypy | |
import boto | |
class Uploader(object): | |
@cherrypy.expose | |
@cherrypy.tools.json_out() | |
def index(self, myFile=None): | |
try: | |
FileValidator(myFile) | |
except ValueError as err: |
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 Baby < RubyProgrammer | |
attr_accessor :age, :gender, :name | |
after_create :dad_will_be_happy | |
def dad_will_be_happy | |
puts 'Wohoo he\'s a boy' | |
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
def attr_redeable(attribute) | |
hash = { | |
:naturaleza => { | |
'1' => "Deudora", | |
'2' => 'Acreedora' | |
}, | |
:nivel_cuenta => { | |
'1' => 'Titulo', | |
'2' => 'Mayor', | |
'3' => 'Subcuenta', |
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
int array[100]; | |
for(int i = 0; i < array.length(); i ++) { | |
if (isFizz(array[i]) && isBuzz(array[i])) cout << "FizzBuzz" << endl; | |
else if ( isFizz(array[i])) cout << "Fizz" << endl; | |
else if (isBuzz(array[i])) cout << "Buzz" << endl; | |
} | |
bool isFizz(int elem) { | |
return ( elem % 3 == 0); | |
} |
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
describe "class methods" do | |
describe ".calc_amount" do | |
it "returns 0 when the invoice amount is nil" | |
context "when the invoice status is 'Cancelado'" do | |
it "returns invoice total when the invoice has polizas for the company" | |
it "return 0.0 when the invoice doesnt has not polizas for the company" | |
end | |
end | |
end |
NewerOlder