Skip to content

Instantly share code, notes, and snippets.

View morten-olsen's full-sized avatar
🤖

Morten Olsen morten-olsen

🤖
View GitHub Profile
import React from 'react';
const routeProperty = Symbol();
function extractParams(pattern, url) {
pattern = pattern.replace('*', '');
if (!pattern || !url) {
return {};
}
.enter {
opacity: .01;
}
.enter > div > div {
transform: translateY(1000px) scale(1, 3);
opacity: .01;
}
.enterActive {
@morten-olsen
morten-olsen / openpgp.txt
Created February 8, 2016 14:42
OpenKeychain Linked Identity
This Gist confirms the Linked Identity in my OpenPGP key, and links it to this GitHub account.
Token for proof:
[Verifying my OpenPGP key: openpgp4fpr:8b9df6f4e233d7cc5003ac49726a325560e4198d]
import React from 'react';
const routeProperty = Symbol();
function extractParams(pattern, url) {
pattern = pattern.replace('*', '');
if (!pattern || !url) {
return {};
}
@morten-olsen
morten-olsen / JavaScriptSafeNavigation.md
Created February 17, 2016 16:07 — forked from d-akara/JavaScriptSafeNavigation.md
JavaScript Safe Navigation

Experimental Safe JavaScript Navigation

Implemented using ES6 Proxies and Symbols

Suggestions for improvements welcome!

const nonNavigableTarget = Symbol();

function safe(target, defaultValue) {

One of the corner stone of creating universal web apps today is the history API. For those not aware what that is, this port is mostly not that relevant to you, but in short it allows a page to navigate async while still retain browser features such as a correct url, and respond correctly to browser navigation.

Most SPA framework today as well as custom solutions reply on this in order to navigate, and give the user a feeling of still using a browser.

One problem though, you can’t rely on this in the later versions of Safari, not on iOS not in OSX. The reason being that Apple has introduced a security feature in their current version, preventing more than 100 calls to history.replaceState or history.pushState. What this means is that when your user has visited a maximum of a 100 pages the application will break. Or in cases, as ours, where you keep the history state current by using history.replaceState when you make changes to your application state, a lot less.

To see what i mean, you c

@morten-olsen
morten-olsen / react-proptype-warnings-as-errors-with-sinon.markdown
Created July 18, 2016 12:59 — forked from scmx/react-proptype-warnings-as-errors-with-sinon.markdown
Make React PropType warnings throw errors with mocha.js, enzyme.js and sinon.js

Make React PropType warnings throw errors with enzyme.js + sinon.js + mocha.js

A simple stateless functional component that we want to test that it renders without propType warnings.

import React, { PropTypes } from 'react'

let VersionListItem = function ({ active, version }) {
  return (
@morten-olsen
morten-olsen / gist:62cde98fe6d86cdeb2de244f0d3b1d41
Created September 5, 2016 10:35 — forked from msmuenchen/gist:9318327
KeePass v2.x (KDBX v3.x) file format
Convention: Byte array notation as it would appear in a hexeditor.
= Layout=
KDBX files, the keepass database files, are layout as follows:
1) Bytes 0-3: Primary identifier, common across all kdbx versions:
private static $sigByte1=[0x03,0xD9,0xA2,0x9A];
2) Bytes 4-7: Secondary identifier. Byte 4 can be used to identify the file version (0x67 is latest, 0x66 is the KeePass 2 pre-release format and 0x55 is KeePass 1)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Keybase proof

I hereby claim:

  • I am morten-olsen on github.
  • I am mortenolsen (https://keybase.io/mortenolsen) on keybase.
  • I have a public key ASAOpVpVirr9Za_gL3vj2P8YZzo8JxCQyg-mLvBc_WeNQgo

To claim this, I am signing this object: