Skip to content

Instantly share code, notes, and snippets.

View ear1grey's full-sized avatar

Rich Boakes ear1grey

View GitHub Profile
@ear1grey
ear1grey / transforms.html
Created December 8, 2022 09:39
Example of how transform order can alter results.
<!DOCTYPE html>
<meta charset="utf-8">
<meta name="description" content="Transformation order is important.">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style>
#red {
fill: red;
animation: redanim 2s infinite;
[
"one",
"two",
"three"
]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Circles</title>
<p>A little example of how <b style="color: blue;">sine</b> and <b style="color: red;">cosine</b> combine to draw a circle.
<p>The <b style="color: blue;">blue</b> line shows a <b style="color: blue;">sine</b> wave travelling along the x axis. For values of <i>i</i> between 0 and <abbr title="this is Tau, which = 2π">τ</abbr>, the wave starts from the bottom of the canvas before sweeping up to the top and then back down.
<p>The <b style="color: red;">red</b> line shows how (for the same values of i, and when plotted on a vertical instead of a horizontal axis) a cosine wave does not start at the edge of the canvas, but instead starts in the middle, so it sweeps right then left, before return to the middle.
@ear1grey
ear1grey / uop_logo_pride.svg
Last active June 3, 2020 12:38
Adjust diagonal red.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ear1grey
ear1grey / scale-example.js
Created November 1, 2017 14:39
Example of using context.scale in HTML5 canvas
let can = document.createElement('canvas');
let c = can.getContext("2d");
document.body.appendChild(can);
can.width = 300;
can.height = 500;
can.style = "border: dashed black thin;";
// Calculate scale value so that using dimensions
@ear1grey
ear1grey / data.json
Created February 23, 2017 07:03
Anscombe's Quartet as JSON
{
"sets": {
"set1": [
[10.0,8.04],
[8.0,6.95],
[13.0,7.58],
[9.0,8.81],
[11.0,8.33],
[14.0,9.96],
[6.0,7.24],
@ear1grey
ear1grey / url.svg
Last active November 22, 2016 11:16
url parts colour coded (with hideous colours)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
/* Prints a greeting */
class Greeter {
public void greet(String name) {
System.out.println(
"Hello " + name
);
}
}
@ear1grey
ear1grey / greetfunction.java
Created September 30, 2016 15:00
Greet functions in various languages.
/* Prints a greeting */
class Greeter {
public void greet(String name) {
System.out.println(
"Hello " + name
);
}
}
@ear1grey
ear1grey / fmmv
Created July 21, 2015 08:36
Front Matter Move: Rename files in a folder based on the date contained in jekyll/markdown frontmatter
#!/bin/sh
# extracts date from file in the format
# date: 2013-08-23 14:52:59
# and prepends this to the filename
for f in *.md; do
c="$(grep -Eo 'date:\W(....-..-..)' $f | cut -d: -f2 | xargs)"
mv "$f" "$c-$f"
done