Skip to content

Instantly share code, notes, and snippets.

View axelav's full-sized avatar
🕸️

Axel Anderson axelav

🕸️
View GitHub Profile
@axelav
axelav / 55-bytes-of-css.md
Created September 27, 2022 09:43 — forked from JoeyBurzynski/55-bytes-of-css.md
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
// https://www.strava.com/athlete/training
// json -> csv https://konklone.io/json/
const MAX_PAGE = 50; // calculate this using (activities/20 + 1)
const ACTIVITY_TYPE = "Workout"; // change to the workout type you want, or blank for all
/* const url = "https://www.strava.com/athlete/training_activities" + */
/* "?keywords=&activity_type=" + ACTIVITY_TYPE + "&workout_type=&commute=&private_activities=" + */
/* "&trainer=&gear=&new_activity_only=false" + */
/* "&page=" + p + "&per_page=20"; */
@axelav
axelav / api.js
Created January 8, 2020 00:55
`useFetch` example
// https://github.com/zeit/next.js/blob/8e2097997e75d8867a9111c861b624e35e14f811/examples/with-graphql-faunadb/graphql/api.js
import useFetch from '../lib/useFetch'
function getData(data) {
if (!data || data.errors) return null
return data.data
}
function getErrorMessage(error, data) {
scheme: "Gruvbox dark, pale"
author: "Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox)"
base00: "262626" # ----
base01: "3a3a3a" # ---
base02: "4e4e4e" # --
base03: "8a8a8a" # -
base04: "949494" # +
base05: "dab997" # ++
base06: "d5c4a1" # +++
base07: "ebdbb2" # ++++
#!/bin/sh
usage () {
printf "Usage: build <argument>\n"
}
INDEX="./src/index.js"
JS_BUNDLE="bundle.js"
CSS_BUNDLE="bundle.css"
INDEX_HTML="index.html"
04e4a0b6208d78906c346120364a823cc4fc44c41369a85c19f2168f621047b33c270eef60f4ad1602d5cf1cd636ba37d95f97cdafa3c4f1808aa787c4c192b577
@axelav
axelav / localStorage-polyfill.js
Last active January 23, 2018 00:14 — forked from juliocesar/best-localStorage-polyfill-evar.js
This is the best localStorage polyfill in the world
if (!('localStorage' in window)) {
window.localStorage = {
_data : {},
setItem : function(id, val) { return this._data[id] = String(val); },
getItem : function(id) { return this._data.hasOwnProperty(id) ? this._data[id] : undefined; },
removeItem : function(id) { return delete this._data[id]; },
clear : function() { return this._data = {}; }
};
}
# Configuration for Alacritty, the GPU enhanced terminal emulator
# The FreeType rasterizer needs to know the device DPI for best results
# (changes require restart)
dpi:
x: 96.0
y: 96.0
# Display tabs using this many cells (changes require restart)
tabspaces: 2
const fs = require('fs')
const SecurePassword = require('secure-password')
const pwd = SecurePassword()
const command = process.argv[2]
const inputUsername = process.argv[3]
const inputPassword = Buffer.from(process.argv[4])
if (command === 'createUser') return createUser(inputUsername, inputPassword)
if (command === 'verify') return verify(inputUsername, inputPassword)
module.exports = function bar (bus) {
setInterval(() => {
bus.emit('foo', {bar: [69, 69, 69]})
}, 6900)
bus.on('bar', data => {
console.log('foo', data)
})
}