Skip to content

Instantly share code, notes, and snippets.

View gregdaynes's full-sized avatar
Tech & Politics are intertwined. Everyone is welcome, your hate is not.

Gregory Daynes gregdaynes

Tech & Politics are intertwined. Everyone is welcome, your hate is not.
View GitHub Profile
javascript:(function()%7Bvar%20css%20%3D%20%60%2F*!*%20Revenge%20CSS%20v%201.0*%20Copyright%202013%2C%20Heydon%20Pickering%3A%20http%3A%2F%2Fwww.heydonworks.com*%20Released%20under%20Attribution%203.0%20Unported%20license%20-%20http%3A%2F%2Fcreativecommons.org%2Flicenses%2Fby%2F3.0%2F*%20Please%20leave%20this%20comment%20block%20intact%20as%20attribution*%2Fa%3Anot(%5Bhref%5D)%2C%20a%5Bhref%3D%22%22%5D%2C%20a%5Bhref%24%3D%22%23%22%5D%2C%20a%5Bhref%5E%3D%22javascript%22%5D%2C.button%3Anot(button)%3Anot(%5Brole%3D%22button%22%5D)%3Anot(%5Btype%3D%22button%22%5D)%3Anot(%5Btype%3D%22submit%22%5D)%3Anot(%5Btype%3D%22reset%22%5D)%2C.btn%3Anot(button)%3Anot(%5Brole%3D%22button%22%5D)%3Anot(%5Btype%3D%22button%22%5D)%3Anot(%5Btype%3D%22submit%22%5D)%3Anot(%5Btype%3D%22reset%22%5D)%2Ca%5Bclass*%3D%22button%22%5D%3Anot(%5Brole%3D%22button%22%5D)%2Ca%5Brole%3D%22button%22%5D%3Anot(%5Bhref*%3D%22%2F%22%5D)%3Anot(%5Bhref*%3D%22.%22%5D)%3Anot(%5Bhref*%3D%22%3F%22%5D)%2Ca%5Brole%3D%22button%22%5D%5Bhref%3D%22%22%5D%2C%20a%5
@gregdaynes
gregdaynes / page_js_generator.rb
Created July 19, 2023 17:26
Jekyll Plugin to concatenate and minify frontmatter array of js files - requires terser
require "terser"
require "digest"
module Jekyll
# Override class for jekyll's static files
# this allows the creation of files without a source file
class GeneratedStaticFile < Jekyll::StaticFile
attr_accessor :file_contents
def initialize(site, dir, name)
@gregdaynes
gregdaynes / page_css_generator.rb
Last active July 19, 2023 17:25
Jekyll Plugin to concatenate frontmatter array of css files
require "digest"
module Jekyll
# Override class for jekyll's static files
# this allows the creation of files without a source file
class GeneratedStaticFile < Jekyll::StaticFile
attr_accessor :file_contents
def initialize(site, dir, name)
@site = site
require('crypto').randomBytes(128).toString('hex')
@gregdaynes
gregdaynes / template.md
Created May 15, 2022 18:37
ADR Template

[short title of solved problem and solution]

  • Status: [proposed | rejected | accepted | deprecated | … | superseded by ADR-0005]
  • Deciders: [list everyone involved in the decision]
  • Date: [YYYY-MM-DD when the decision was last updated]

Technical Story: [description | ticket/issue URL]

Context and Problem Statement

Keybase proof

I hereby claim:

  • I am gregdaynes on github.
  • I am gregdaynes (https://keybase.io/gregdaynes) on keybase.
  • I have a public key ASAt0d0YrRp1lefyXfqDAy5BeTDLksJAyutHJJdYytvxCwo

To claim this, I am signing this object:

@gregdaynes
gregdaynes / commands-i-use.md
Created October 4, 2016 21:39
Commands I use often

Show disk usage

df -h

Find all files over X size

find / -size 10000k -print0 | xargs -0 ls -l

@gregdaynes
gregdaynes / promise-reduce.js
Last active August 6, 2016 05:37
Fetch and reduce json data
// Transform JSON array of stats into object
// concat values into single strings for each key
// ----------------------------------------------
function transform(json) {
// iterate over each item in the JSON array
// replace null values with empty strings
// concat new value onto old value
return json.results.reduce(function(acc, data) {
return acc.then(prev => {
return {
@gregdaynes
gregdaynes / zapier-es5.js
Last active January 8, 2022 18:19
Zapier fetch json return comma separated values in object. Return data to google spreadsheet and use =transpose(split(A1,",")) to convert each cell into a column of values.
// Zapier injects their own callback, this is just for testing
// -----------------------------------------------------------
function callback(err, results) {
if (err) throw new Error(err);
console.log(results);
return results;
}
// Transform JSON array of stats into object
// concat values into single strings for each key
@gregdaynes
gregdaynes / gist:9164542
Last active August 29, 2015 13:56
Pixel colour using canvas.
<!doctype html>
<html>
<head>
</head>
<body>
<img id="my-image" src="colour.png" />
<script>
var colorImage = function(image, x, y, x2, y2) {