Skip to content

Instantly share code, notes, and snippets.

View skogsmaskin's full-sized avatar

Per-Kristian Nordnes skogsmaskin

View GitHub Profile
import {switchMap, tap} from 'rxjs/operators'
import {EMPTY, Observable, OperatorFunction, defer, of} from 'rxjs'
export function bufferUntil<T>(
emitWhen: (currentBuffer: T[]) => boolean
): OperatorFunction<T, T[]> {
return (source: Observable<T>) =>
defer(() => {
let buffer: T[] = [] // custom buffer
return source.pipe(
export default function SplitNodeSelectionPlugin() {
return {
onCommand(command, editor, next) {
const splitOperationsInsertingNewBlock = editor.operations.filter(
op => op.type === 'split_node' && op.path.size === 1
)
if (splitOperationsInsertingNewBlock.size === 0) {
return next()
}
return splitOperationsInsertingNewBlock
@skogsmaskin
skogsmaskin / remoteauth.md
Last active November 16, 2017 18:05
Sanity.io : Auth the CLI when installed remotely
  • Go to https://api.sanity.io/v1/auth/login/github?type=token&origin=http://localhost

    Exchange github for google if you prefer that. You don't need anything running on localhost.

  • Pick out the value of the sid param in the return url trying to load on localhost.

  • Load https://api.sanity.io/v1/auth/fetch?sid=xxxx using the sid value from above.

  • Pick out the token from the result.

@skogsmaskin
skogsmaskin / linuxmonitoroverclock.md
Last active March 19, 2016 19:43
Overclocking a YAMAKASI Catleap Q270 "2B Extreme OC" in Linux with Nvidia Driver

Find new modelines

Download and compile cvt_modeline_calculator_12 which will give access to CVT v.1.2 reduced blanking timings not supported by standard xorg tools.

# cd ~/ && wget https://raw.githubusercontent.com/kevinlekiller/cvt_modeline_calculator_12/master/cvt12.c && gcc cvt12.c -O2 -o cvt12 -lm -Wall

Example for 110Hz:

# ./cvt12 2560 1440 110 -b

### Keybase proof
I hereby claim:
* I am skogsmaskin on github.
* I am pkn (https://keybase.io/pkn) on keybase.
* I have a public key whose fingerprint is 5AD2 B551 ABEE 528C 8340 3801 96A6 2302 8AAB C043
To claim this, I am signing this object:
@skogsmaskin
skogsmaskin / gist:11261988
Last active August 29, 2015 14:00
How to start Unicorn on Mac OS X via LaunchAgents (LaunchCtl)

How to start Unicorn on Mac OS X via LaunchAgents (LaunchCtl)

First make a bootup bundle for RVM.

$ rvm wrapper $(rvm current) bootup bundle

Add this xml to ~/Library/LaunchAgents/apps.myapp.unicorn.plist

@skogsmaskin
skogsmaskin / postgis_mapnik_tilestache_leaflet_WGS84_to_UTM.md
Last active March 10, 2018 17:42
Reproject PostGIS through Mapnik, Tilestache and Leaflet into other projections

Reproject PostGIS through Mapnik, Tilestache and Leaflet into other projections

This is an example on how to configure Tilestache, Mapnik and Leaflet to handle reprojections.

###TileStache

{
  "cache": {...},