Skip to content

Instantly share code, notes, and snippets.

View alexej-d's full-sized avatar
:shipit:

Alexej Dyschelmann alexej-d

:shipit:
View GitHub Profile
@ngryman
ngryman / example.ts
Created June 29, 2019 17:24
Updating cached data from multiple parameterized queries after a mutation (hacky solution)
addTask({
variables: { input },
optimisticResponse: {
addTask: {
__typename: 'Task',
id,
...input
}
},
update: (proxy: any, { data: { addTask } }: any) => {
@tomjn
tomjn / tomjn_http2_push.php
Created January 25, 2019 23:43
A naive and incomplete, but functional approach to http2 push
<?php
/**
* Plugin name: HTTP2 Push scripts
* Author: Tom J Nowell
*/
function tomjn_get_dep_url( /*\WP_Dependency*/ $dep ) {
global $wp_version;
$relative = str_replace( site_url(), '', $dep->src );
$ver = $dep->ver;
@timvisee
timvisee / falsehoods-programming-time-list.md
Last active May 3, 2024 06:43
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@nickpeihl
nickpeihl / index.html
Created September 18, 2017 23:26
Interactive Choropleth Map - Leaflet Example
<!DOCTYPE html>
<html>
<head>
<title>Choropleth Tutorial - Leaflet</title>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon"

procedural mesh generation

Generates an algorithmic 3D OBJ file with ThreeJS and Node.js.

# print to stdout
node generate-mesh.js > test.obj

# write to file
node generate-mesh.js test.obj
@beeman
beeman / remove-all-from-docker.sh
Created November 15, 2016 03:04
Remove all from Docker
# Stop all containers
docker stop `docker ps -qa`
# Remove all containers
docker rm `docker ps -qa`
# Remove all images
docker rmi -f `docker images -qa `
# Remove all volumes
@kevin-smets
kevin-smets / macos-virtualbox-ubuntu-server-docker.md
Last active February 3, 2023 02:22
macOS VirtualBox headless Ubuntu Server and Docker setup

Get started

Install virtualbox and the extension pack:

brew install --cask docker virtualbox virtualbox-extension-pack

Download the ubuntu server image and create a VBox for it, the rest of the readme assumes it is named "Ubuntu Server".

Enable SSH

@eloypnd
eloypnd / dnsmasq_setup_osx.md
Last active April 28, 2024 14:32
wildcard DNS record on OS X in localhost development with dnsmasq

wildcard DNS in localhost development

$ brew install dnsmasq
   ...
$ cp /usr/local/opt/dnsmasq/dnsmasq.conf.example /usr/local/etc/dnsmasq.conf
  • edit /usr/local/etc/dnsmasq.conf
address=/local/127.0.0.1
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@nathansearles
nathansearles / isAutoplaySupported.js
Last active December 13, 2022 11:06
Test if HTML5 video autoplay is supported
// isAutoplaySupported(callback);
// Test if HTML5 video autoplay is supported
isAutoplaySupported = function(callback) {
// Is the callback a function?
if (typeof callback !== 'function') {
console.log('isAutoplaySupported: Callback must be a function!');
return false;
}
// Check if sessionStorage exist for autoplaySupported,
// if so we don't need to check for support again