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
function makelist(x) {return [x]} | |
makelist(document.head[0]) | |
makelist("DKC:TF") | |
makelist("6502") | |
makelist(0xf13e455d7a1b96cd2d930e578284d889) |
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 printNumbers = () => { | |
[1,2,3].forEach((number) => console.log(`Hello, ${number}`)) | |
} | |
printNumbers() |
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 print = (list) => { | |
list.forEach((number) => console.log(`Hello, ${number}`)) | |
} | |
print([1,2,3]) | |
print(["D","K","C"]) |
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 print = (list) => { | |
list.forEach((item) => { | |
// naming become harder :( | |
var itemDescription | |
if (typeof item === "object") { | |
itemDescription = item.name | |
} else { | |
itemDescription = item | |
} | |
console.log(`Annyong, ${itemDescription}`) |
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 print = (list) => { | |
list.forEach((item) => { | |
var itemDescription | |
if (typeof item === "object") { | |
itemDescription = item.name || item.brand | |
if (item.arch) { | |
itemDescription = `${item.name} - ${item.arch}` | |
} | |
} else { | |
itemDescription = item |
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 defaultPrint = (item) => console.log(`Hello, ${item}`) | |
var myForEach = (list, printFunction = defaultPrint) => { | |
list.forEach((item) => printFunction(item)) | |
} | |
myForEach([1,2,3]) | |
myForEach(["D","K","C"]) | |
myForEach([{name: "Tomba!"},{name: "Neo Cortex"}], (person) => defaultPrint(person.name)) | |
myForEach([{brand: "Ferrari"}, {brand: "Mercedes"}], (car) => defaultPrint(car.brand)) | |
myForEach([{name: "N64", arch: "MIPS"}, {name: "3DS", arch: "ARM9"}], (console) => defaultPrint(`${item.name} - ${item.arch}`)) |
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
rails new myapp --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
# we'll use an existent image which already have ruby installed | |
FROM ruby:2.3.0 | |
# creating our app folder | |
RUN mkdir /myapp | |
# move to this folder | |
WORKDIR /myapp | |
# move the Gemfile to our app's root folder | |
ADD Gemfile /myapp/Gemfile | |
# move the Gemfile.lock too | |
ADD Gemfile.lock /myapp/Gemfile.lock |
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
# we'll call our web app of web | |
web: | |
# it'll build this container based the docker file ./Dockerfile | |
build: . | |
# it'll run this command to star the server | |
command: bash -c "rm -f tmp/pids/server.pid || true && bundle exec rails s -p 3000 -b '0.0.0.0'" | |
# it'll export the port 3000 | |
ports: | |
- "3000:3000" | |
# it links to db container (on mongoid.yaml at rail's config we say host: db:27017 it's linked) |
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
# we'll build our container from an existent image :) | |
FROM nginx | |
# for some reason we need to create this folder | |
RUN mkdir -p /var/lib/nginx/proxy | |
# copy our app config to nginx | |
COPY sites-enabled/myapp.conf /etc/nginx/nginx.conf |