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 / fragment.md
Created April 25, 2017 15:34
Introducing `<fragment>` element

Introducing <fragment> element

The problem

Web pages are often built of several high-level building blocks, like <Navigation>, <Content>, <Aside> and <Footer>. A typical web page looks roughly like this:

<html>
	<head>
 
@jhnns
jhnns / git-pr
Last active March 15, 2021 07:50
Git custom command to quickly checkout pull-requests from different origins as described in https://help.github.com/articles/checking-out-pull-requests-locally. Place this file somewhere in your path and git will run it everytime you type `git pr ...`
#!/bin/bash
if [ -z "$1" ]; then
echo "Usage: git pr [clean] [<remote>] <id-or-url>"
echo ""
echo "Examples:"
echo "git pr 42 --> git fetch origin pull/42/head:pr/origin/42"
echo "git pr upstream 42 --> git fetch upstream pull/42/head:pr/upstream/42"
echo "git pr https://github.com/peerigon/phridge/pull/1 --> git fetch https://github.com/peerigon/phridge.git pull/1/head:pr/peerigon/phridge/1"
echo "git pr clean --> Deletes all branches that match pr/*/* and pr/*/*/*"
@jhnns
jhnns / gist:5192282
Last active October 10, 2020 13:26
Contents of httpd-vhosts.conf when running multiple virtual host with xampp. https:// only works after creating a certificate as described here: http://robsnotebook.com/xampp-ssl-encrypt-passwords
## It's important to use normal slashes for paths also on windows
<VirtualHost *:80>
DocumentRoot "C:/Users/jhnns/dev/xampp/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/Users/jhnns/dev/peerigon.dev"
ServerName peerigon.dev
@jhnns
jhnns / index.json
Last active May 26, 2020 03:10
Most popular web repositories with at least 10.000 stars. Compiled in May 2017 with https://github.com/jhnns/popular-javascript-projects. The list of repo types can be found at https://gist.github.com/jhnns/d233e88b40f5a2993c240847ccef4ee3.
[
{
"name": "freeCodeCamp/freeCodeCamp",
"description": "The https://freeCodeCamp.com open source codebase and curriculum. Learn to code and help nonprofits.",
"stars": 266038,
"type": "other"
},
{
"name": "twbs/bootstrap",
"description": "The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.",
@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 / 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 / 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 / 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.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}",