Skip to content

Instantly share code, notes, and snippets.

View seflless's full-sized avatar

Francois Laberge seflless

View GitHub Profile
@seflless
seflless / README.md
Created October 10, 2015 13:08 — forked from mbostock/.block
Streamgraph

For zontinuous data such as time series, a streamgraph can be used in place of stacked bars. This example also demonstrates path transitions to interpolate between different layouts. Streamgraph algorithm, colors, and data generation inspired by Byron and Wattenberg.

// Regular commander.js logic up here. None of this
// logic is run if a subcommand match was found
var knownSubCommands = [
"blah",
"ha",
"etc"
]

Elm has well thought out versioning rules. Because of Elm's strong type system their package manager could (can?) enforce the rules. They already have a CLI command to generate a report of what's changed between any two versions of a module.

For example, to compare changes between elm-lang/core's module 3.0.0 vs 4.0.0, run: elm-package diff elm-lang/core 3.0.0 4.0.0 which will produce:

Comparing elm-lang/core 3.0.0 to 4.0.0...
This is a MAJOR change.

------ Added modules - MINOR ------

Expandable Markdown Sections

This markdown..

<p><details>
  <summary>
    <b>Expand for puppy</b>
    </summary>
    <img src="http://youthvoices.net/sites/default/files/image/129678/dec/1600dog_11019_1.jpg"/>
</details></p>
@seflless
seflless / test.js
Last active June 18, 2017 14:51
Medium Embedding Test
function test(){
const a = "a";
}
@seflless
seflless / useGesture.js
Created July 8, 2021 18:09
useGesture Example
import appActor from '../state/actors/app';
import { useGesture } from '@use-gesture/react'
import { useEffect, useRef } from "react"
import { getCamera } from "../cameras/usePanZoom";
export function usePanZoomEvents() {
const panZoomStartPositionInWorldSpace = useRef()
console.log("usepanzoom");
@seflless
seflless / logSVG.js
Last active July 16, 2022 13:45
Visually display an SVG element as an image in the dev tools console
function logSVG(svg){
// Get svg data
var xml = new XMLSerializer().serializeToString(svg);
// Make it base64
var svg64 = btoa(xml);
var b64Start = 'data:image/svg+xml;base64,';
// Prepend a "header"
var image64 = b64Start + svg64;
@seflless
seflless / parseVideoConfigurationDescriptions.ts
Created September 19, 2023 16:35
Given the description field in a VideoDecoder configuration, parse out data so that it can be inspected or logged.
// See VideoDecoder.configure for documentation on all configuration fields:
// https://developer.mozilla.org/en-US/docs/Web/API/VideoDecoder/configure
type AvcCData = {
configurationVersion: number;
profileIndication: number;
profileCompatibility: number;
avcLevelIndication: number;
lengthSizeMinusOne: number;
sps: Uint8Array[];

ChatGPT Builds A Rudimentary Whiteboarding App

Here's the conversation I had collaborating with ChatGPT to build a basic diagramming app.

Features

  • Canvas based rendering
  • You can create rectangles (click to create a rectangle)
  • You can move rectangles (click on Move Rectangle)
  • You can change the fill color of rectangles (Click on Change Color, then click on a rectangle to randomly assign it a fill color)

Notes

socket.on("server-text-to-speech") {data, ack in
print("server-text-to-speech")
// The data structure for this message type is here:
// https://github.com/descriptinc/descript-web-v2/blob/staging/pkg-js/brain-buddy-protocol/src/ServerSentEvents.ts#L27-L48
if let firstItem = data.first as? [String: Any],
guard let progress = firstItem["progress"] as? String else {
return
}