Skip to content

Instantly share code, notes, and snippets.

🧀
When in doubt add cheese!

Johannes Ewald jhnns

Block or report user

Report or block jhnns

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jhnns
jhnns / app.js
Created Mar 1, 2019
Medium code example
View app.js
import person form "./person.css";
element.innerHTML = `<h1 class="${person.name}">Name</h1>`;
@jhnns
jhnns / person.css
Created Mar 1, 2019
Medium code example
View person.css
.name {
background: hotpink;
}
@jhnns
jhnns / gulpfile.js
Created Nov 16, 2018
How to debug a Node.js server written in TypeScript running in Docker
View gulpfile.js
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 Nov 16, 2018
How to debug a Node.js server written in TypeScript running in Docker
View launch.json5
{
"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 Nov 16, 2018
How to debug a Node.js server written in TypeScript running in Docker
View launch.json
{
"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 Nov 16, 2018
How to debug a Node.js server written in TypeScript running in Docker
View Dockerfile
FROM node:10.8.0-alpine
WORKDIR /server
COPY package.json package-lock.json ./
RUN npm ci
COPY . /server
CMD [ "npm", "run", "start" ]
View shadow-dom-example.js
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 Aug 19, 2018
custom-element-example
View custom-element-example.js
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 Aug 19, 2018
Template element example
View template-example.html
...
<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 Apr 6, 2018
JavaScript library types.
View index.json
[
{
"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."
},
{
You can’t perform that action at this time.