Skip to content

Instantly share code, notes, and snippets.

View benchristel's full-sized avatar

Ben Christel benchristel

View GitHub Profile
@EllyLoel
EllyLoel / reset.css
Last active June 28, 2024 04:00
CSS Reset
/*
Made by Elly Loel - https://ellyloel.com/
With inspiration from:
- Josh W Comeau - https://courses.joshwcomeau.com/css-for-js/treasure-trove/010-global-styles/
- Andy Bell - https://piccalil.li/blog/a-modern-css-reset/
- Adam Argyle - https://unpkg.com/open-props@1.3.16/normalize.min.css / https://codepen.io/argyleink/pen/KKvRORE
Notes:
- `:where()` is used to lower specificity for easy overriding.
*/
@apieceofbart
apieceofbart / test.js
Last active July 16, 2024 06:22
Async testing with jest fake timers and promises
PLEASE CHECK THIS REPO WITH THE EXAMPLES THAT YOU CAN RUN:
https://github.com/apieceofbart/async-testing-with-jest-fake-timers-and-promises
// Let's say you have a function that does some async operation inside setTimeout (think of polling for data)
function runInterval(callback, interval = 1000) {
setInterval(async () => {
const results = await Promise.resolve(42) // this might fetch some data from server
callback(results)
}, interval)
@lolmaus
lolmaus / autokey_generate.rb
Last active May 28, 2022 20:03
A script to generate AutoKey configuration files that enable a new layer on your keyboard
# This Ruby script generates a config for the AutoKey Linux app.
# The config adds another layer to your keyboard.
# First, choose a modifier key that will activate the layer:
primary_modifier = 'super'
# Then outline which keys will do which actions.
# On the left is the desired action, on the right is the hotkey
# that activates the action. For example, if your modifier is
# the the Super key, then "left: :j" means that when you press
@dmckeone
dmckeone / gist:da287e50b0449e2944fb
Created April 30, 2014 17:12
What we know in Computer Science
Inspired by this (http://carmandrew.com/home/2013/9/3/can-we-please-put-the-science-back-into-computer-science), this is a list of papers and summaries of what they say:
- Boehm (1975): most errors are introduced during requirements analysis and design. Not during writing and debugging. The later a bug is removed, the more it costs to remove.
- Woodfield (1979): For every 25% increase in problem complexity, there is a 100% increase in solution complexity. It's non-linear because of interaction effects.
- van Genuchten (1991): The two biggest causes of project failure are poor estimation and unstable requirements, neither of which seem to be improving in the industry as a whole.
- Thomas et al. (1997, but it hasn't been replicated yet): If more than 20-25% of a component has to be revised, it's better to rewrite it from scratch. (This study was done on software for flight avionics, so it may or may not generalize).
- Fagan (1975 at IBM): Hour for hour, sitting down and reading the code is the most effectiv
@matthewmccullough
matthewmccullough / git-compressing-and-deltas.md
Created May 14, 2012 19:05
Git, Compression, and Deltas - An explanation

Git Compression of Blobs and Packfiles.

Many users of Git are curious about the lack of delta compression at the object (blob) level when commits are first written. This efficiency is saved until the pack file is written. Loose objects are written in compressed, but non-delta format at the time of each commit.

A simple run though of a commit sequence with only the smallest change to the image (in uncompressed TIFF format to amplify the observable behavior) aids the understanding of this deferred and different approach efficiency.

The command sequence:

Create the repo: