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
@gregdaynes
gregdaynes / combined.scss
Last active December 20, 2015 02:29
SASS Mixins I use all the time
/*--------------------*\
functions.scss
\*--------------------*/
@function em($px){
@return ($px/16px)+0em;
}
@gregdaynes
gregdaynes / gist:7894926
Last active December 30, 2015 22:29
Modular Typography

An Event Apart: Universal Typography

At An Event Apart in San Francisco CA 2013, Tim Brown shared fundamental best practices for typography and how to make the most of them on the Web. Here's my notes from his talk Universal Typography:

  • The Web is the best place for text: it can be searched, copied, translated, printed, and more.
  • We're doing things with text that couldn't have been imagined when many typographic standards were established and thought out but that doesn't mean we don't keep doing our job. There will always be things for which designers and developers aren't prepared. The web is always changing. Think abstractly but work in the details.
  • Characters are unique characters. Glyphs are representations of these characters. Type designers don't just think about glyphs, they spend a lot of time focused on the negative spaces between letters. Drawing and spacing type are simultaneous parts of the same process.
  • Size, leading, and measure are the balance
@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) {
@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 / 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 / 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

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 / 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

require('crypto').randomBytes(128).toString('hex')
@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