Skip to content

Instantly share code, notes, and snippets.

View hkjels's full-sized avatar

Henrik Kjerringvåg hkjels

View GitHub Profile
View
Action
Binder
# Responsible for binding Selectors to properties of the View
selectDerivedState -> State
State
selectedValue -> View
@hkjels
hkjels / index.html
Created June 8, 2018 08:51
Tiny video-player
<!doctype html>
<html>
<head>
<title>Tiny video-player</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
<link rel="stylesheet" href="video.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.16.0/polyfill.min.js"></script>
<script defer src="video.js"></script>
</head>
<body>
@hkjels
hkjels / outline-ivy.el
Created June 7, 2018 06:45
Eric Kaschalk's outline-ivy
(require 'ivy)
(require 'macros)
(require 'outshine)
(provide 'outline-ivy)
;;; Config
(defvar oi-height 20
"Number of outlines to display, overrides ivy-height.")
(defn find-in
"Find all of the keys & indices of the [tree] that leads to the
value of [s]earch"
[tree s]
(some
(fn [[k v]]
(cond
(= v s) [k]
(map? v) (if-let [r (find-in v s)]
(into [k] r))
@hkjels
hkjels / logging.cljc
Last active March 14, 2017 17:34
Log all inputs to console or REPL, the input is returned for further manipulation
(defn log
"Log all inputs to console or REPL, the input is returned for further manipulation"
[& in]
(do
(apply #?(:clj println :cljs js/console.log) in)
in))
@hkjels
hkjels / index.html
Last active October 26, 2016 12:37
Slideshow
<!doctype>
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
<link rel="stylesheet" href="./slideshow.css">
<title>Slideshow</title>
</head>
<body>
<div class="slideshow">
<img src="https://files.slack.com/files-pri/T0DB7B8US-F2TTMTJG6/toppbilde_10mot2020_1920x400_06.jpg?pub_secret=d038f6b149">
@hkjels
hkjels / beer.js
Last active September 1, 2016 07:25
Beerme.io
let beer = document.querySelector('.beer');
function spawnBubble() {
let bubble = document.createElement('span');
let rand = parseInt(Math.random() * (100 - 0) - 0);
bubble.classList.add('bubble');
bubble.classList.add('start');
bubble.style.left = `${rand}%`;
let timer = setTimeout(() => {
beer.appendChild(bubble);
@hkjels
hkjels / lifelines.cljs
Last active May 27, 2016 08:52
There are no remote calls being made
(defmethod read :lifelines/title
[{:keys [state]} k _]
{:value "Boooom!"})
(defmethod read :lifelines/items
[{:keys [state ast] :as env} k _]
(let [st @state]
(if (contains? st k)
{:value (get st k)}
{:remote true})))
@hkjels
hkjels / datomic-queries.clj
Created December 3, 2015 08:33 — forked from fabioyamate/datomic-queries.clj
Datomic Queries cheat-sheet
;;; Replace entity with the schema
{:find [...]
:in [...]
:where [...]}
;;; eav
[?e ?a ?v ?tx]
;;; txInstant
@hkjels
hkjels / .prompt.sh
Created September 29, 2015 07:15
Characters left hanging upon use of history
#!/usr/bin/env bash
PS1="\["
# Jobs
PS1+="\[$YELLOW\]\$([ \j -gt 0 ] && echo '[\j] ') \[$RESET\]"
# Path
PS1+="\[$CYAN\]\w \[$RESET\]"