Skip to content

Instantly share code, notes, and snippets.

View sverrejoh's full-sized avatar

Sverre Johansen sverrejoh

View GitHub Profile
@sverrejoh
sverrejoh / index.js
Created November 13, 2014 15:53
requirebin sketch
var Immutable = require('immutable');
l1 = Immutable.List([Immutable.Map({morradi:"mann"}), 1337])
l2 = Immutable.List([Immutable.Map({morradi:"mann"}), 1337])
alert(l1.equals(l2))
{
"name": "esteban-saves-the-world",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "./node_modules/browserify/bin/cmd.js -t babelify -o bundle.js index.js",
"watch": "./node_modules/.bin/watchify -vd -t babelify -t react-hot-transform -p browserify-hmr index.js -o bundle.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
@sverrejoh
sverrejoh / addToMap.js
Created November 4, 2015 14:09
Add to a List in a Map
state.set(action.tickedId, (state.get(action.ticketId) || Immutable.List()).push(action.file));
/* @flow */
type FooStyle = {
style: {
width: number,
},
data: {
type: "foo"
}
}

Keybase proof

I hereby claim:

  • I am sverrejoh on github.
  • I am sverrejoh (https://keybase.io/sverrejoh) on keybase.
  • I have a public key whose fingerprint is 7203 A99C 1EBD 3131 C287 EBC6 CB5C 1539 6D30 593B

To claim this, I am signing this object:

@sverrejoh
sverrejoh / index.flow.jsx
Last active July 18, 2016 21:13
React component with typed Refs
// @flow
import React from "react";
type Refs = {
// the ref `foo` is a button (or null, because it might not be mounted).
foo: HTMLButtonElement | null
};
class Foo extends React.Component {
<html lang="nb"><head><base href="http://device.e-pages.dk/template/packages2/default/2/7/default/1_desktop/">
<!-- Template version: 1 -->
<!-- Template date: 2016-09-01 11:24:59 -->
<!-- Template base version: 7 -->
<!-- Template base date: 2016-09-01 11:24:58 -->
<title></title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<meta id="viewport" name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link href="singlearticlepage_type_article_style_articleview/singlearticlepage_type_article_style_articleview.css?[NO_CACHE]" type="text/css" rel="stylesheet">
@sverrejoh
sverrejoh / .zshrc
Created May 6, 2020 15:34
Function for sending a notification from shell
function tellme() {
# The success value from the previous command (have to keep it or
# it'll be overwritten by the equation below)
local previous=$?
local statusMessage
[[ $previous -eq 0 ]] \
&& statusMessage="Success" \
|| statusMessage="Failure"
@sverrejoh
sverrejoh / README.md
Created May 25, 2020 19:36
US Layout with Caps Lock as Ctrl and Norwegian letters æøå similar to the Mac

Keyboard Layout Creator Source File

This is a US Layout for Windows, with Caps Lock as Ctrl and æøå on alt-; alt-o and alt-a, Like the Mac US Layout

const delayRenderMs = 1000;
const loadBeforeAnimateMs = 2000;
const timeoutMs = 15 * 1000;
const minLoadMs = 250;
const machine = Machine(
{
id: "load",
initial: "delay",