Skip to content

Instantly share code, notes, and snippets.

View pomber's full-sized avatar
🧭
Building @code-hike

Rodrigo Pombo pomber

🧭
Building @code-hike
View GitHub Profile
@pomber
pomber / ko.animated-css.js
Created February 22, 2013 20:59
knockout animation on class change
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 February 28, 2016 00:36
From Zero to Polymer: Step 01 - document.registerElement
<!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 February 28, 2016 00:54
From Zero to Polymer: Step 02 - template
<!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 February 28, 2016 02:31
From Zero to Polymer: Step 03 - HTML import
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="import" href="my-element.html">
</head>
<body>
<my-element></my-element>
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
@pomber
pomber / package.json
Created March 14, 2017 22:44
Root package.json with nested scripts
{
"stuff": "...",
"scripts": {
"postinstall": "run-p install:api install:web",
"install:api": "cd api && npm install",
"install:web": "cd web && npm install",
"start": "run-p start:api start:web",
"start:api": "npm run start --prefix api",
"start:web": "npm run start --prefix web",
@pomber
pomber / node.dockerfile
Created March 30, 2017 13:49
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" ]
@pomber
pomber / nginx.dockerfile
Created March 30, 2017 14:04
NGINX Dockerfile
FROM nginx:alpine
COPY web/build /usr/share/nginx/html
COPY docker/nginx.node.conf /etc/nginx/conf.d/default.conf
@pomber
pomber / nginx.node.conf
Created March 30, 2017 14:06
NGINX 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 March 30, 2017 15:30
Basic node Travis config
sudo: false
language: node_js
node_js:
- "node"
cache:
yarn: true
before_install: npm install yarn -g
script:
- npm test
- npm run build