Skip to content

Instantly share code, notes, and snippets.

View smuemd's full-sized avatar

Stefan Thon smuemd

  • FH-Potsdam
  • Berlin
View GitHub Profile
@smuemd
smuemd / index.html
Created January 17, 2019 17:22 — forked from panoply/index.html
Rollup Configuration – Uses Buble, SASS and Serve. Use with Mithril.js
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Mithril Rollup.js</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="bundle.css" rel="stylesheet" />
</head>
<body>
<div id="app"></div>
@smuemd
smuemd / simple-nodejs-iv-encrypt-decrypt.js
Created September 17, 2018 09:14 — forked from yoavniran/simple-nodejs-iv-encrypt-decrypt.js
nodejs crypto - simple encrypt & decrypt using IV (Initialization Vector)
"use strict";
var crypto = require("crypto");
var EncryptionHelper = (function () {
function getKeyAndIV(key, callback) {
crypto.pseudoRandomBytes(16, function (err, ivBuffer) {
var keyBuffer = (key instanceof Buffer) ? key : new Buffer(key) ;
@smuemd
smuemd / bytestokey.js
Created September 17, 2018 09:07 — forked from bnoordhuis/bytestokey.js
Compute key+IV from passphrase (createCipher to createCipheriv migration script)
// Copyright (c) 2017, Ben Noordhuis <info@bnoordhuis.nl>
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
@smuemd
smuemd / parseURLParameters.js
Created September 4, 2018 12:42 — forked from pirate/parseURLParameters.js
Parse URL query parameters in ES6
function getUrlParams(search) {
let hashes = search.slice(search.indexOf('?') + 1).split('&')
let params = {}
hashes.map(hash => {
let [key, val] = hash.split('=')
params[key] = decodeURIComponent(val)
})
return params
}
@smuemd
smuemd / combinators.js
Created August 6, 2018 20:24 — forked from Avaq/combinators.js
Common combinators in JavaScript
const I = x => x;
const K = x => y => x;
const A = f => x => f(x);
const T = x => f => f(x);
const W = f => x => f(x)(x);
const C = f => y => x => f(x)(y);
const B = f => g => x => f(g(x));
const S = f => g => x => f(x)(g(x));
const P = f => g => x => y => f(g(x))(g(y));
const Y = f => (g => g(g))(g => f(x => g(g)(x)));
@smuemd
smuemd / paas.txt
Created July 21, 2018 09:35 — forked from aaronshaf/paas.txt
Docker-Based Micro-PaaS
otto
https://ottoproject.io/
https://github.com/hashicorp/otto
deis
https://deis.com/
https://github.com/deis/deis
has 5 full-time devs
flynn
@smuemd
smuemd / sensible-defaults.css
Created June 20, 2018 09:10 — forked from cesarandreu/sensible-defaults.css
Sensible css defaults taken from css-layout
div, span {
box-sizing: border-box;
position: relative;
display: flex;
flex-direction: column;
align-items: stretch;
flex-shrink: 0;
align-content: flex-start;
@smuemd
smuemd / 0. intro.md
Created April 17, 2018 09:36 — forked from jquense/0. intro.md
Alternative ways to define react Components

The 0.13.0 improvements to React Components are often framed as "es6 classes" but being able to use the new class syntax isn't really the big change. The main thing of note in 0.13 is that React Components are no longer special objects that need to be created using a specific method (createClass()). One of the benefits of this change is that you can use the es6 class syntax, but also tons of other patterns work as well!

Below are a few examples creating React components that all work as expected using a bunch of JS object creation patterns (https://github.com/getify/You-Dont-Know-JS/blob/master/this%20&amp;%20object%20prototypes/ch4.md#mixins). All of the examples are of stateful components, and so need to delegate to React.Component for setState(), but if you have stateless components each patterns tends to get even simpler. The one major caveat with react components is that you need to assign props and context to the component instance otherwise the component will be static. The reason is

@smuemd
smuemd / gwalink-review-st.sol
Created April 5, 2017 21:10
Stefans gwalink Review
@smuemd
smuemd / materialDesignShadowHelper.less
Created August 27, 2016 20:43 — forked from gefangenimnetz/materialDesignShadowHelper.less
Less css box-shadow helper for cards & modals according to Googles Material Design spec.
/**
* A mixin which helps you to add depth to elements according to the Google Material Design spec:
* http://www.google.com/design/spec/layout/layout-principles.html#layout-principles-dimensionality
*
* Please note that the values given in the specification cannot be used as is. To create the same visual experience
* the blur parameter has to be doubled.
*
* Author: Florian Kutschera (@gefangenimnetz), Conceptboard GmbH (@conceptboardapp)
*
* Example usage: