Skip to content

Instantly share code, notes, and snippets.

@donpark
donpark / VIA Porting Info.md
Created May 23, 2019 09:31 — forked from nooges/VIA Porting Info.md
Info on adding VIA Configurator support to a board using QMK

Making a board compatible with VIA Configurator

💥NOTE💥: Don't do this yet, all of this stuff is still 🚑💣BLEEDING EDGE💣🚑, and you will 🔪cut yourself🔪 badly if you choose to do it. Please wait for 🗿Wilba's QMK code to be refactored prior to pushing anything to QMK, as we don't want to end up with a bunch of different forks of the code.

So you've seen VIA Configurator in action, and you want to get this magic supported for your board?

There's two main steps:

  1. Add dynamic keymap support to keyboard in QMK
  2. Add layout to VIA
// Built with IMPACT - impactjs.org
(function (window) {
"use strict";
Number.prototype.map = function (istart, istop, ostart, ostop) {
return ostart + (ostop - ostart) * ((this - istart) / (istop - istart));
};
Number.prototype.limit = function (min, max) {
return Math.min(max, Math.max(min, this));
};
Number.prototype.round = function (precision) {
@donpark
donpark / hdlines.js
Created August 11, 2017 20:50 — forked from srt19170/hdlines.js
Hand-Drawn Lines Code (Javascript)
//
// Draw a line with the given curve, and then resample it
// to a new set of points. <step> is the distance to step
// along the line when taking a new point.
//
function drawInterpolate(svg, points, step, curve) {
curve = curve || d3.curveCatmullRom.alpha(1.0);
step = step || 1;
var lineFunc = d3.line()
.curve(curve)
@donpark
donpark / JSONFeed.ts
Last active March 16, 2021 10:23
Rough first cut of JSON Feed types and interfaces
/** JSON Feed TypeScript Declaration
* Spec Version: 1
*/
declare namespace JSONFeed {
const MIME_TYPE = 'application/json'
type DATEstring = RFC3339string
type IDstring = string
@donpark
donpark / PaperSetup.tsx
Created May 6, 2017 01:15
Setup Paper.js for use in React.js
import * as React from 'react'
import { Component } from 'react'
import { PaperScope } from 'paper'
export class PaperSetup extends Component<any, any> {
constructor(props) {
super(props)
window['paper'] = new PaperScope()
}
@donpark
donpark / NotificationEnum.swift
Created December 2, 2016 18:17
How to use enum of Notification.Name
import Foundation
// Extension allowing enum of Notification.Names.
#if swift(>=3.0)
extension Notification.Name: ExpressibleByStringLiteral {
public init(stringLiteral value: String) {
self.init(value)
}
@donpark
donpark / README.md
Created November 22, 2016 04:24
Visible Touch support for demos and ReplayKit uses

Integration

Add VisibleTouch.swift to your project then replace window instance variable declaration in AppDelegate.swift file:

var window: UIWindow?

with:

var window: UIWindow? = VisibleTouch.Window(frame: UIScreen.main.bounds)
@donpark
donpark / aws-sdk-s3.ts
Created September 26, 2016 02:33
augment aws-sdk S3 with missing methods
import * as AWS from 'aws-sdk'
// extend S3 class via interface.
// could not get class augmenting to work in time. maybe not be possible even.
declare interface S3Extended extends AWS.S3 {
// missing methods
headBucket(params: any, callback?: (err: Error, data: any) => void): any;
createBucket(params: any, callback?: (err: Error, data: any) => void): any;
getBucketPolicy(params: any, callback?: (err: Error, data: any) => void): any;
putBucketPolicy(params: any, callback?: (err: Error, data: any) => void): any;
getBucketCors(params: any, callback?: (err: Error, data: any) => void): any;
@donpark
donpark / upload-a-s3-stream.js
Created September 23, 2016 08:43
node-slack-sdk example showing how to upload a S3 stream
var path = require('path');
var url = require('url');
var request = require('request');
var WebClient = require('@slack/client').WebClient;
var token = process.env.SLACK_API_TOKEN || '';
var web = new WebClient(token);
var s3Url = 'https://testbucket.s3-us-west-2.amazonaws.com/some/file/in/S3.mp4';
var s3Stream = // from s3.GetObject call
@donpark
donpark / upload-a-stream.js
Created September 20, 2016 23:14
node-slack-sdk example showing how to upload a stream
var path = require('path');
var url = require('url');
var request = require('request');
var WebClient = require('@slack/client').WebClient;
var token = process.env.SLACK_API_TOKEN || '';
var web = new WebClient(token);
var fileUrl = 'http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4';
var fileName = path.basename(url.parse(fileUrl).pathname);