Skip to content

Instantly share code, notes, and snippets.

View drewminns's full-sized avatar
🤙
I do stuff

Drew Minns drewminns

🤙
I do stuff
View GitHub Profile
*,
::before,
::after {
box-sizing: border-box; /* 1 */
border-width: 0; /* 2 */
border-style: solid; /* 2 */
border-color: currentColor; /* 2 */
}
html {
// You don't need Node installed.
// Don't create a package.json file with `npm init -y`
// Don't tnstall node-fetch with `npm i node-fetch`
// Don't run the app with `node index.js` in your terminal
import fetch from "node-fetch";
const number = 1000;
const naziPunksGoHome = async () => {
@drewminns
drewminns / usePerformanceData.ts
Created August 11, 2021 21:11
Get browser network data - Won't work in iOS Safari
import { useEffect, useState } from 'react'
export function usePerformanceData() {
const [size, setSize] = useState(0)
useEffect(() => {
if (process.browser) {
const performance = window.performance || {}
if (performance.getEntries) {
const data: any[] = [...performance.getEntries()]
@drewminns
drewminns / carbon.ts
Created August 11, 2021 21:10
Calculate CO2 from Bytes - Adapted from https://www.websitecarbon.com/
const KWG_PER_GB = 1.805
const RETURNING_VISITOR_PERCENTAGE = 0.75
const FIRST_TIME_VIEWING_PERCENTAGE = 0.25
const PERCENTAGE_OF_DATA_LOADED_ON_SUBSEQUENT_LOAD = 0.02
const CARBON_PER_KWG_GRID = 475
const CARBON_PER_KWG_RENEWABLE = 33.4
const PERCENTAGE_OF_ENERGY_IN_DATACENTER = 0.1008
const PERCENTAGE_OF_ENERGY_IN_TRANSMISSION_AND_END_USER = 0.8992
const CO2_GRAMS_TO_LITRES = 0.5562
@drewminns
drewminns / spacing.js
Created February 16, 2021 19:00
Spacing
spacing: {
px: '1px',
0: '0px',
0.5: '0.125rem',
1: '0.25rem',
1.5: '0.375rem',
2: '0.5rem',
2.5: '0.625rem',
3: '0.75rem',
3.5: '0.875rem',
import React, { RefForwardingComponent, useReducer, useState, useEffect, forwardRef, useImperativeHandle } from 'react'
import ImageKit from 'imagekit-javascript'
import { ImageKitResponse } from '../interfaces'
const imagekit = new ImageKit({
publicKey: process.env.IMAGEKIT_PUBLIC_KEY || 'fasdf',
urlEndpoint: process.env.IMAGEKIT_ENDPOINT || 'asdfasdf',
authenticationEndpoint: '/api/auth/assets',
})
// Query matches
https://frinkiac.com/api/search?q=duffman
// returns
// [{"Id":1823368,"Episode":"S13E21","Timestamp":297339},{"Id":1667129,"Episode":"S12E15","Timestamp":1250166}]
// Get a matching caption using the returned array
// e = Episode, t = Timestamp
http://frinkiac.com/api/caption?e=S07E04&t=244026
$columns: (
small: 4,
medium: 6,
large: 12,
xl: 12
);
$gutter: 20px;
$padding: $gutter;
$breakpoints: (
.container
header.lead-header
h1
h3
section.feature
a.feature__item
img
p
a.feature__item
img
<h1 id="css-grid-systems">CSS Grid Systems</h1>
<p>Within graphic design circles, a grid system is used to structure content and create organize elements on a page. It is used to create columns that span the page at different widths, and maintain equal margins between.</p>
<p>Within web design, it can be used to help layout designs and build your structure quickly, as well as provide an easy route for making your site responsive.</p>
<h2 id="what-does-it-look-like">What does it look like?</h2>
<h3 id="bricks">Bricks</h3>