Skip to content

Instantly share code, notes, and snippets.

View jhnns's full-sized avatar
🧀
When in doubt add cheese!

Johannes Ewald jhnns

🧀
When in doubt add cheese!
View GitHub Profile
@jhnns
jhnns / app.js
Created March 1, 2019 15:19
Medium code example
import person form "./person.css";
element.innerHTML = `<h1 class="${person.name}">Name</h1>`;
@jhnns
jhnns / person.css
Created March 1, 2019 15:16
Medium code example
.name {
background: hotpink;
}
@jhnns
jhnns / gulpfile.js
Created November 16, 2018 10:51
How to debug a Node.js server written in TypeScript running in Docker
return tsResult.js
.pipe(
sourcemaps.mapSources(function(sourcePath, file) {
return "../../" + sourcePath; // rewrite sourcePath to point to the correct TypeScript file paths
})
)
.pipe(sourcemaps.write("./"))
.pipe(gulp.dest("./dist/src"));
@jhnns
jhnns / launch.json5
Last active November 16, 2018 12:05
How to debug a Node.js server written in TypeScript running in Docker
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Attach to Server in Docker",
"port": 9222,
"timeout": 10000,
"stopOnEntry": true,
@jhnns
jhnns / launch.json
Created November 16, 2018 10:36
How to debug a Node.js server written in TypeScript running in Docker
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Docker: Attach to Node",
"port": 9229,
"address": "localhost",
"localRoot": "${workspaceFolder}",
@jhnns
jhnns / Dockerfile
Last active November 16, 2018 11:56
How to debug a Node.js server written in TypeScript running in Docker
FROM node:10.8.0-alpine
WORKDIR /server
COPY package.json package-lock.json ./
RUN npm ci
COPY . /server
CMD [ "npm", "run", "start" ]
@jhnns
jhnns / shadow-dom-example.js
Created August 19, 2018 18:14
shadow-dom-example
customElements.define("my-bubble", class extends HTMLElement {
constructor() {
super();
const template = document.getElementById("my-element-template").content;
const shadowRoot = this.attachShadow({mode: "open"});
shadowRoot.appendChild(template.cloneNode(true));
}
});
@jhnns
jhnns / custom-element-example.js
Last active August 19, 2018 18:08
custom-element-example
customElements.define("my-bubble", class extends HTMLElement {
constructor() {
super();
const template = document.getElementById("my-element-template").content;
const color = this.getAttribute("background") || "white";
template.querySelector(".bubble").style.background = color;
}
});
@jhnns
jhnns / template-example.html
Created August 19, 2018 17:46
Template element example
...
<template id="my-element-template">
<style>
.bubble {
border: .4rem solid black;
border-radius: 2rem;
margin: 1rem;
padding: 1rem .5rem;
cursor: pointer;
font-size: 20px;
@jhnns
jhnns / index.json
Last active April 6, 2018 01:19
JavaScript library types.
[
{
"name": "web-framework",
"description": "Transforms a given application state into an HTML or DOM representation. Additionally, it is also often concerned with request routing, data fetching and persistence, change propagation, input validation, user session management and build optimizations."
},
{
"name": "testing-framework",
"description": "Provides a CLI and an API to run software tests and report results."
},
{