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 / DuplicateDependenciesError.js
Created February 1, 2017 14:58
Duplicate Dependencies Webpack Plugin
class DuplicateDependenciesError extends Error {
constructor(duplicateDependencies) {
super();
Error.captureStackTrace(this, DuplicateDependenciesError);
const messages = duplicateDependencies.map(helpfulErrorMessage);
const dedupedMessages = dedupeMessages({})(messages);
this.name = "DuplicateDependenciesError";
this.message = "compilation\nDuplicate dependencies found:\n" + dedupedMessages.join("\n");
test
@jhnns
jhnns / bundle.js
Created November 30, 2016 22:13
Simple webpack 2 bundle (containing ES2015 modules)
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
@jhnns
jhnns / gpg.md
Created November 4, 2016 16:17 — forked from LauLaman/gpg.md
Use GPG to sign commits using git & PHPStorm

1 - install GPG tools : https://gpgtools.org/

2 - Create new key for your github email

3 - Add key to git on your local machine: git config --global user.signingkey YOURKEY

4 - configure git to sign all commits: git config --global commit.gpgsign true

5 - add to the bottom of ~/.gnupg/gpg.conf:

npm run build

commented webpack.optimize.UglifyJsPlugin

build/static/app/css/styles.css

._1gwPWr77dmf4i5iRBt9FXY {
  border-color: #1abc9c !important; }
@jhnns
jhnns / idea.md
Created February 19, 2016 14:56
angular 1 babel plugin idea

angular 1 babel plugin idea

Mitigates angular module boilerplate with ES2015 modules based on naming conventions:

import template from "./modal.html";
import UserService from "./UserService";
import AnotherService from "./AnotherService";

function ModalDirective() {
var phridge = require('phridge');
var simpleLogScript = require.resolve('./simpleLogScript.js');
var phantomInstances = {};
function spawnPhantom(id) {
return phridge.spawn()
.then(function (phantom) {
phantomInstances[id] = phantom;
@jhnns
jhnns / in.css
Created February 2, 2016 16:31
postcss-merge-rules bug (see https://github.com/ben-eb/postcss-merge-rules/issues/14) with `cssnano v3.4.0 (cli v1.0.3)`
.a {
font-family: Arial;
font-family: Helvetica;
}
.b {
font-family: Arial;
}
@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/*/*/*"