This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const p1 = { x: 59197011, y: 42146958, z: 42913136384, sx: 24, sy: 470 }; | |
const p2 = { x: 59197011, y: 21399618, z: 42913136384, sx: 254, sy: 664 }; | |
const p3 = { x: 6735114, y: 33773393, z: 4287356928 , sx: 808, sy: 65 }; | |
const p4 = { x: 26245172, y: 42146958, z: 4293136384, sx: 495, sy: 212 }; | |
function project({x, y, z}) { | |
// use p4 as the origin | |
x -= p4.x; | |
y -= p4.y; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Array where Element : Hashable { | |
func modalValue() -> Self.Element? { | |
// populate a dictionary of element vs count | |
var dict: [Self.Element : Int] = [:] | |
self.forEach { v in | |
if let count = dict[v] { | |
dict[v] = count + 1 | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
#include <stdbool.h> | |
extern void lcddata(unsigned char n); | |
static inline uint16_t | |
display_uint16_t_digit( | |
uint16_t n, uint16_t div, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; input value location | |
.exportzp X0 := $10 | |
.exportzp X1 := X0 + 1 | |
; final result appears in [R3:R2] | |
.exportzp R0 := X1 + 1 | |
.exportzp R1 := R0 + 1 | |
.exportzp R2 := R0 + 2 | |
.exportzp R3 := R0 + 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function memoize(factory, ctx, mapper) { | |
const cache = new Map(); | |
return function(...keys) { | |
const key = mapper ? mapper(keys) : keys[0]; | |
if (!cache.has(key)) { | |
cache.set(key, factory.apply(ctx, keys)); | |
} | |
console.debug(cache); | |
return cache.get(key); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import CoreMIDI | |
let source = Int(CommandLine.arguments[1])! | |
let dest = Int(CommandLine.arguments[2])! | |
var owner = "uk.me.rb.thru" as CFString? | |
// dispose of any existing connections with the same owner | |
var obj = Data() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UInt48 { | |
constructor(n) { | |
if (n instanceof UInt48) { | |
Object.assign(this, n); | |
} else if (typeof n === 'number') { | |
let w0 = n & 0xffff; | |
n /= 0x10000; | |
let w1 = n & 0xffff; | |
n /= 0x10000; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <stddef.h> | |
int main(int argc, char *argv[]) | |
{ | |
const size_t bufsize = 4096; | |
uint8_t buf_a[bufsize]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(function($) { | |
"use strict"; | |
$.memoize = function(factory, ctx) { | |
var cache = {}; | |
return function(key) { | |
if (!(key in cache)) { | |
cache[key] = factory.call(ctx, key); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*global jQuery */ | |
;(function($) { | |
/*global document */ | |
"use strict"; | |
if (typeof document !== 'undefined' && ('classList' in document.createElement('a'))) { | |
var $ = jQuery; |
NewerOlder