Skip to content

Instantly share code, notes, and snippets.

Avatar
🧭
Building @code-hike

Rodrigo Pombo pomber

🧭
Building @code-hike
View GitHub Profile
@pomber
pomber / ko.animated-css.js
Created Feb 22, 2013
knockout animation on class change
View ko.animated-css.js
var classesWrittenByBindingKey = '__ko__cssValue';
ko.bindingHandlers.animatedCss = {
'update': function (element, valueAccessor) {
var value = ko.utils.unwrapObservable(valueAccessor());
if (typeof value == "object") {
var currentClassList = element.className.split(/\s+/);
var removeClassList = [];
var addClassList = [];
@pomber
pomber / index.html
Last active Feb 28, 2016
From Zero to Polymer: Step 01 - document.registerElement
View index.html
<!DOCTYPE html>
<html lang="en">
<body>
<my-element></my-element>
<my-element></my-element>
<script>
var MyElementProto = Object.create(HTMLElement.prototype);
@pomber
pomber / index.html
Created Feb 28, 2016
From Zero to Polymer: Step 02 - template
View index.html
<!DOCTYPE html>
<html lang="en">
<body>
<template id="my-element-template">
<p>My <b>custom element</b> markup!</p>
</template>
<my-element></my-element>
<my-element></my-element>
@pomber
pomber / index.html
Last active Feb 28, 2016
From Zero to Polymer: Step 03 - HTML import
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="import" href="my-element.html">
</head>
<body>
<my-element></my-element>
View Install Visual Studio Code on Linux
curl -L https://go.microsoft.com/fwlink/?LinkID=620884 > /tmp/vscode.zip
unzip -qq /tmp/vscode.zip -d /tmp
sudo cp -r /tmp/VSCode-linux-x64 /opt/vscode
sudo ln -s /opt/vscode/code /usr/local/bin/vscode
sudo rm -rf /tmp/VSCode-linux-x64
sudo rm -f /tmp/vscode.zip
sudo touch /usr/share/applications/vscode.desktop
sudo chmod 777 /usr/share/applications/vscode.desktop
sudo echo -e "[Desktop Entry]\nName=VSCode\nComment=Visual Studio Code\nExec=/opt/vscode/code\nIcon=/opt/vscode/resources/app/resources/linux/code.png\nType=Application\nVersion=1.0\nTerminal=false\nCategories=Development" > /usr/share/applications/vscode.desktop
sudo chmod 644 /usr/share/applications/vscode.desktop
View node.dockerfile
FROM node:alpine
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY server/dist /usr/src/app
EXPOSE 8080
CMD [ "node", "server.js" ]
View nginx.dockerfile
FROM nginx:alpine
COPY web/build /usr/share/nginx/html
COPY docker/nginx.node.conf /etc/nginx/conf.d/default.conf
View nginx.node.conf
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
location /api/ {
@pomber
pomber / .travis.yml
Created Mar 30, 2017
Basic node Travis config
View .travis.yml
sudo: false
language: node_js
node_js:
- "node"
cache:
yarn: true
before_install: npm install yarn -g
script:
- npm test
- npm run build
@pomber
pomber / .travis.yml
Created Mar 30, 2017
Add docker, gcloud and kubectl to Travis
View .travis.yml
cache:
directories:
- "$HOME/google-cloud-sdk/"
services:
- docker
before_deploy:
- if [ ! -d "$HOME/google-cloud-sdk/bin" ]; then rm -rf $HOME/google-cloud-sdk; export CLOUDSDK_CORE_DISABLE_PROMPTS=1; curl https://sdk.cloud.google.com | bash; fi
- source /home/travis/google-cloud-sdk/path.bash.inc
- gcloud --quiet version
- gcloud --quiet components update