Skip to content

Instantly share code, notes, and snippets.

View amundo's full-sized avatar
🛒
(0)

Patrick Hall amundo

🛒
(0)
  • Massachusetts
  • 18:25 (UTC -12:00)
View GitHub Profile
@amundo
amundo / index.html
Created January 18, 2024 18:43
WebCOLD 04
<super-slider unit="em" target=".preview h1">
<label for="title-size">Title font size</label>
<input id="title-size" type="range" min="0.5" max="4" step="0.1" value="2" />
</super-slider>
<super-slider unit="em" target=".preview h2">
<label>Subtitle font size</label>
<input type="range" min="0.5" max="2.5" step="0.1" value="1.5" />
</super-slider>
<div class="preview">
@amundo
amundo / kaboom-tutorials.md
Last active August 4, 2021 13:41
Resources for learning Kaboom.js
document.querySelectorAll('p')
.forEach(p => p.style.border = '4px solid red')
@amundo
amundo / SVG Path to Polygon.js
Created December 21, 2020 16:44 — forked from Phrogz/SVG Path to Polygon.js
Convert a SVG path to a Polygon by sampling the path, but also including all control points in the result. See http://phrogz.net/SVG/convert_path_to_polygon.xhtml
// http://phrogz.net/SVG/convert_path_to_polygon.xhtml
function pathToPolygon(path,samples){
if (!samples) samples = 0;
var doc = path.ownerDocument;
var poly = doc.createElementNS('http://www.w3.org/2000/svg','polygon');
// Put all path segments in a queue
for (var segs=[],s=path.pathSegList,i=s.numberOfItems-1;i>=0;--i) segs[i] = s.getItem(i);
var segments = segs.concat();
@amundo
amundo / parse-eaf.js
Last active July 3, 2020 14:29
a simple parser for simple eaf files
/*
ANNOTATION_DOCUMENT - top level
HEADER - unique top-level node containing references to media, and arbitrary name/value PROPERTY pairs
MEDIA_DESCRIPTOR - links to media files
PROPERTY - generic key-value element. wt actual f.
TIME_ORDER - array of TIME_SLOTs
TIME_SLOT - a single point in the timeline
@amundo
amundo / index.html
Created July 2, 2020 01:47
Star Wars Opening Crawl (HTML/CSS/JS)
<section class="intro">
A long time ago, in a galaxy far,<br> far away....
</section>
<section class="logo">
<svg version="1.0" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="693.615px" height="419.375px" viewBox="0 0 693.615 419.375" enable-background="new 0 0 693.615 419.375"
xml:space="preserve">
<g id="Layer_2">
<g>
@amundo
amundo / 2-layers-svg-as.txt
Last active December 6, 2019 16:41
sample svg with 2 "layers"
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
id="svg28094"
viewBox="0 0 744.09448819 1052.3622047"
@amundo
amundo / sample-page-render-pdfjs.js
Created October 27, 2018 14:48
loading a pdf and rendering a page with pdf.js
pdfjsLib.getDocument('helloworld.pdf')
.then(pdf => pdf.getPage(1)
.then(page => {
var scale = 1.5
var viewport = page.getViewport(scale)
var canvas = document.createElement('canvas')
var context = canvas.getContext('2d')
canvas.height = viewport.height
canvas.width = viewport.width
@amundo
amundo / movies.xml
Created September 4, 2018 15:19
an xml file with an xsl “stylesheet”
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="movies.xsl" ?>
<collection>
<movie>
<title>Happy Gilmore</title>
<year>1996</year>
<genre>comedy</genre>
</movie>
<movie>
@amundo
amundo / IndexedDB101.js
Created June 5, 2018 01:29 — forked from JamesMessinger/IndexedDB101.js
Very Simple IndexedDB Example
// This works on all devices/browsers, and uses IndexedDBShim as a final fallback
var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB;
// Open (or create) the database
var open = indexedDB.open("MyDatabase", 1);
// Create the schema
open.onupgradeneeded = function() {
var db = open.result;
var store = db.createObjectStore("MyObjectStore", {keyPath: "id"});