Skip to content

Instantly share code, notes, and snippets.

View joar's full-sized avatar
:bowtie:
Not wearing a bowtie

Joar Wandborg joar

:bowtie:
Not wearing a bowtie
View GitHub Profile
@joar
joar / index.html
Created November 13, 2015 14:16 — forked from anonymous/index.html
JS Bin // source http://jsbin.com/koyoqiyuti
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
html, body {
height: 100%;
margin: 0;
}
@joar
joar / jq-insert-var.sh
Last active July 24, 2025 14:46
Add a field to an object with JQ
# Add field
echo '{"hello": "world"}' | jq --arg foo bar '. + {foo: $foo}'
# {
# "hello": "world",
# "foo": "bar"
# }
# Override field value
echo '{"hello": "world"}' | jq --arg foo bar '. + {hello: $foo}'
{
@joar
joar / README.rst
Last active March 21, 2022 06:30
Using unicode in your SSID on ASUS RT-AC66U, in ASUSWRT

Using unicode in your SSID on ASUS RT-AC66U

!DANGER!

This might void your warranty. Do it on your own risk.

I'm using the 🐟 emoji character as my SSID, because I like to be special.

How I do it

# Example xorg.conf.d snippet that assigns the touchpad driver
# to all touchpads. See xorg.conf.d(5) for more information on
# InputClass.
# it when updating. Copy (and rename) this file into
# /etc/X11/xorg.conf.d first.
# Additional options may be added in the form of
# Option "OptionName" "value"
#
Section "InputClass"
# MARK apply-synclient
@joar
joar / clear-comments.md
Last active July 25, 2019 16:14
Solarized Light - Clear Comments

Solarized Light - Clear Comments

Code comments are usually put in the code to clarify something or specify something that is not obvious based on the code itself, right?

In that case, you want to be able to read the comments. that means the comments shouldn't be a few shades away from the background color.

Fixing it

@joar
joar / .tmux.conf
Created September 15, 2015 13:30
tmux: Enable mouse scrolling, windown and pane select. Also provides a binding to disable/enable mouse for copy/pase.
# mouse-mode
set-window-option -g mode-mouse on
set-option -g mouse-resize-pane on
set-option -g mouse-select-pane on
set-option -g mouse-select-window on
# toggle mouse mode to allow mouse copy/paste
# set mouse on with prefix m
bind m \
set -g mode-mouse on \;\
/**
* Collision handler. Use with d3.quadtree.visit
* @param n Node
* @param responseCoefficient How much of the overlap should be eliminated
* each step. Range: 0..1
* @param state Optional state object to insert debug information into.
* @returns {Function}
*/
export function collide(n, {responseCoefficient=1, debugLines=null}) {
let nx = getExtent(n) // Node extent
@joar
joar / TrackingMap.js
Created September 9, 2015 09:53
Key -> value mapping that keeps track of if any value has been updated.
/**
* Key -> value mapping that keeps track of if any value has been updated.
*/
class TrackingMap {
constructor(initial={}) {
this.updated = true
for (let field in initial) {
if (field.charAt(0) == '_') {
throw new Error('You may not start field names with an' +
@joar
joar / collision.js
Last active September 7, 2015 07:37
D3 rectangular collisions
const RIGHT = 0,
DOWN = 1.5707963267948966,
LEFT = Math.PI,
UP = -1.5707963267948966
let DIRECTION_MAP = {}
DIRECTION_MAP[UP] = 'UP'
DIRECTION_MAP[DOWN] = 'DOWN'
DIRECTION_MAP[LEFT] = 'LEFT'
@joar
joar / graph.json
Last active September 9, 2015 09:25 — forked from eyaler/graph.json
Force-Directed Graph with Drag/Zoom/Pan/Center/Resize/Labels/Shapes/Filter/Highlight
{
"graph": [],
"links": [
{"source": 0, "target": 1},
{"source": 0, "target": 2},
{"source": 0, "target": 3},
{"source": 0, "target": 4},
{"source": 0, "target": 5},
{"source": 0, "target": 6},
{"source": 1, "target": 3},