Skip to content

Instantly share code, notes, and snippets.

@conundrumer
conundrumer / lrjs.v0.9.7.update.md
Last active December 28, 2017 21:21
documentation of added functionalities of lrjs v0.9.7

line tool

given a line being drawn:

  • +shift: angle lock (to the line that the drawn line is snapped to)
  • +shift+mod: length snap (to nearest power of 2)
  • +shift+mod+alt: length snap + angle snap

selection tool

@conundrumer
conundrumer / jsonReader.js
Created March 21, 2017 08:04
.track.json reader/writer
let decompress = require('lz-string').decompressFromBase64
const linesArrayAttr = ['type', 'id', 'x1', 'y1', 'x2', 'y2', 'extended', 'flipped', 'leftLine', 'rightLine']
function validateJson ({version, startPosition, lines}) {
if (!(version === '6.2' || version === '6.1')) {
throw new Error(`This track does not have a valid version: ${version}`)
}
if (!(
startPosition instanceof Object &&
@conundrumer
conundrumer / fill.js
Created March 12, 2017 01:19
fill tool example
import track from 'lr/track'
import ui from 'lr/ui'
import tools from 'lr/tools'
import React from 'react'
module.info = {
name: 'Fill Tool',
version: '0.1.0',
author: 'David Lu'
}
@conundrumer
conundrumer / iterators.rs
Created November 22, 2016 21:16
returning iterators in rust
#![feature(conservative_impl_trait)]
// without impl trait or box
use std::iter::{ FlatMap, Map, Enumerate, Iterator };
use std::str::Chars;
type GetIterFnType = Fn((usize, char)) -> Option<char>;
type IdentityType = Fn(Option<char>) -> Option<char>;
type GetIterType<'a> = FlatMap<Map<Enumerate<Chars<'a>>, &'static GetIterFnType>, Option<char>, &'static IdentityType>;
const GET_ITER_FN: &'static GetIterFnType = &|(i, x)| if i % 2 == 0 { Some(x) } else { None };
fn fib(n: u64) -> u64 {
match n {
0 => 1,
1 => 1,
_ => fib(n - 1) + fib(n - 2)
}
}
fn fib_fast(n: u64) -> u64 {
let mut seen = vec![None; 1 + n as usize];
@conundrumer
conundrumer / pandora.json
Created October 22, 2016 22:41
conundrumer's pandora likes
[
{
"title": "Magaz Stinged",
"artist": "Funckarma",
"station": "Klik Me Radio"
},
{
"title": "Rare & Pelentiful",
"artist": "Tipper",
"station": "Klik Me Radio"
@conundrumer
conundrumer / combiner.js
Created September 15, 2016 06:26
cli tool for combining line rider tracks
// i suppose i should put this somewhere before accidentally losing it
// need to update lr-core to have file import/export so this can work depending only on that and lodash and yargs
'use strict'
let path = require('path')
let fs = require('fs')
let _ = require('lodash')
let argv = require('yargs')
.usage('usage: node combiner.js output.track.json')
.option(0, {

Keybase proof

I hereby claim:

  • I am conundrumer on github.
  • I am delu (https://keybase.io/delu) on keybase.
  • I have a public key whose fingerprint is 48AA B300 E48D 75A1 49AE 5805 00B6 5AB6 8C2E CFC2

To claim this, I am signing this object:

store.dispatch({type: 'SET_CAM', cam:{x:0,y:0,z:0.5}}) // 0.5 is default, z > 0
store.dispatch({type: 'SET_AUDIO_OFFSET', offset: 1}) // offset in seconds