A Pen by Rodrigo Pombo on CodePen.
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
sudo: false | |
language: node_js | |
node_js: | |
- "node" | |
cache: | |
yarn: true | |
directories: | |
- "$HOME/google-cloud-sdk/" | |
services: | |
- docker |
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
sudo: false | |
language: node_js | |
node_js: | |
- "node" | |
cache: | |
yarn: true | |
directories: | |
- "$HOME/google-cloud-sdk/" | |
services: | |
- docker |
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 | |
set -e | |
docker build -t gcr.io/${PROJECT_PROD}/${NGINX_IMAGE}:$TRAVIS_COMMIT -f docker/nginx.dockerfile . | |
docker build -t gcr.io/${PROJECT_PROD}/${NODE_IMAGE}:$TRAVIS_COMMIT -f docker/node.dockerfile . | |
echo $GCLOUD_SERVICE_KEY_TEST | base64 --decode -i > ${HOME}/gcloud-service-key.json | |
gcloud auth activate-service-account --key-file ${HOME}/gcloud-service-key.json |
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
apiVersion: v1 | |
kind: Secret | |
metadata: | |
name: node-secret | |
type: Opaque | |
data: | |
twitter-consumer-key: "output from [echo -n "your key" | base64]" | |
twitter-consumer-secret: "output from [echo -n "your secret" | base64]" | |
mongo-url: "output from [echo -n "mongodb://mongo:27017/sanata" | base64]" | |
--- |
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
deploy: | |
- provider: script | |
script: ./deploy-prod.sh | |
on: | |
all_branches: true | |
condition: $TRAVIS_TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+ | |
- provider: script | |
script: ./deploy-test.sh | |
on: | |
branch: master |
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
export function createElement(type, config, ...args) { | |
const props = Object.assign({}, config); | |
if (args.length) { | |
props.children = [].concat(...args); | |
} | |
return { type, props }; | |
} | |
export function render(element, container) { | |
const instance = new DomComponent(element); |
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
export function createElement(type, config, ...args) { | |
const props = Object.assign({}, config); | |
if (args.length) { | |
props.children = [].concat(...args); | |
} | |
return { type, props }; | |
} | |
export function render(element, container) { | |
const instance = new DomComponent(element); |
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 render(rootDom, element) { | |
const { type, props } = element; | |
const dom = document.createElement(type); | |
Object.keys(props).filter(isAttribute).forEach(name => { | |
dom[name] = props[name]; | |
}); | |
const children = props.children || []; | |
children.forEach(childElement => render(dom, childElement)); | |
rootDom.appendChild(dom); | |
} |
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
// Get an element by id | |
const domRoot = document.getElementById("root"); | |
// Create a new element given a tag name | |
const domInput = document.createElement("input"); | |
// Set properties | |
domInput["type"] = "text"; | |
domInput["value"] = "Hi world"; | |
domInput["className"] = "my-class"; | |
// Listen to events | |
domInput.addEventListener("change", e => alert(e.target.value)); |