Skip to content

Instantly share code, notes, and snippets.

View kevinfjbecker's full-sized avatar
🦄
not doing the things that nobody had ever thought of not doing

Kevin Becker kevinfjbecker

🦄
not doing the things that nobody had ever thought of not doing
View GitHub Profile
@kevinfjbecker
kevinfjbecker / parse_bookmarks_html.js
Created March 24, 2023 21:33
In-console parser for Chrome bookmarks bar export
root = document
.querySelector('h3[personal_toolbar_folder="true"]')
.parentElement
process_dt(root)
/**
* Process dl:
@kevinfjbecker
kevinfjbecker / randomtableparser.js
Created June 3, 2021 13:29
A Parser for D&D Beyond Random Tables
///////////////////////////////////////////////////////////////////////////////
// example from https://www.dndbeyond.com/sources/xgte/character-names
// let id = 'f0edbf90-4ecc-4a4e-9f3f-17f0b154e25f';
const getRandomTable = function(id) {
// src: https://stackoverflow.com/questions/3895478/
const range = (size, startAt = 0) => [...Array(size).keys()].map(i => i + startAt);
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>JS Bin</title>
<style id="jsbin-css">
.button-group {
font-family: Sans-Serif;
@kevinfjbecker
kevinfjbecker / meta-snapshot.js
Created July 6, 2016 14:53
Gather Meta Deck Machups
///////////////////////////////////////////////////////////////////////////////
// get snapshot data -- this might fail, maybe you need to inspect 1st
$bar = $('#deck1').find('.bar-wrap').first();
snapshot = angular.element($bar).scope().snapshot
///////////////////////////////////////////////////////////////////////////////
// inject D3
@kevinfjbecker
kevinfjbecker / ctx-save-restore.js
Last active February 26, 2024 04:19
An example of using canvas methods save() an restore()
var canvas;
var ctx;
function init() {
canvas = document.getElementById("canvas");
ctx = canvas.getContext("2d");
draw();
}
@kevinfjbecker
kevinfjbecker / README.md
Last active April 28, 2020 16:53
Draggable Graph Nodes

This example use HTML5 Canvas to draw a simple graph.

The Node can be dragged to new positions on the canvas.

@kevinfjbecker
kevinfjbecker / aGoT-graph.js
Created January 8, 2012 20:14
A JSON graph representation of the Game of Thrones game board
var graph = {
vertices: [
{ // Castle Black
"x": 240,
"y": 90,
edges: [1,3]
},
{ // Karhold
"x": 320,
"y": 140,
@kevinfjbecker
kevinfjbecker / layout.html
Created January 1, 2012 21:53
Force-based Graph Layout in JavaScript
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Graph Layout</title>
<style>
article, aside, figure, footer, header, hgroup,
menu, nav, section { display: block; }
</style>
</head>
@kevinfjbecker
kevinfjbecker / graph-bfs.html
Created December 28, 2011 16:11
Animated Breadth-First Search (using HTML5 canvas)
<!DOCTYPE html>
<html>
<head>
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<meta charset=utf-8 />
<title>Click a Node</title>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style>
@kevinfjbecker
kevinfjbecker / graph-vis.html
Created December 27, 2011 22:45
HTML5 Canvas Graph View
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>graph-vis</title>
</head>
<body>
<canvas id="viewer" width="800" height="500"></canvas>
<script src="graph-vis.js"></script>
</body>