Skip to content

Instantly share code, notes, and snippets.

@mugi-uno
mugi-uno / remote-work-style-check.md
Last active October 10, 2022 11:26
リモートワークスタイルチェック

リモートワークスタイルチェック

昨今の社会情勢の影響もありリモートワークを導入する企業・チームが増えてきましたが、 一口に「リモートワーク」といってもさまざまなスタイルがあります。

企業側と働く側のミスマッチを防ぐため、リモートワークにおける観点を列挙してみました。

リモートワーク比重度

どの程度リモートワークに比重を置いて導入しているかのチェックリストです。

@senderle
senderle / hand-modify-pdf.md
Created September 23, 2020 15:03
So you want to modify the text of a PDF by hand

So you want to modify the text of a PDF by hand...

If you, like me, resent every dollar spent on commercial PDF tools, you might want to know how to change the text content of a PDF without having to pay for Adobe Acrobat or another PDF tool. I didn't see an obvious open-source tool that lets you dig into PDF internals, but I did discover a few useful facts about how PDFs are structured that I think may prove useful to others (or myself) in the future. They are recorded here. They are surely not universally applicable --
the PDF standard is truly Byzantine -- but they worked for my case.

@paul-krohn
paul-krohn / docker_x11_macOS.md
Last active March 23, 2024 09:30
Docker X11 macOS

Preamble

There is a longstanding issue/missing feature/bug with sockets on Docker on macOS; it may never work; you'll need to use a network connection between Docker containers and X11 on macOS for the foreseeable future.

I started from this gist and made some adjustments:

  • the volume mappings aren't relevant/used, due to the socket issue above.
  • this method only allows X11 connections from your Mac, not the entire local network, which would include everyone on the café/airport WiFi.
  • updated to include using the host.docker.internal name for the the container host, instead.
  • you have to restart XQuartz after the config change.
@OliverJAsh
OliverJAsh / foo.tsx
Last active August 15, 2023 06:43
TypeScript React HOC using `forwardRef`
import * as React from 'react';
import { Component, ComponentClass, createRef, forwardRef, Ref } from 'react';
const myHoc = <ComposedComponentProps extends {}>(
ComposedComponent: ComponentClass<ComposedComponentProps>,
) => {
type ComposedComponentInstance = InstanceType<typeof ComposedComponent>;
type WrapperComponentProps = ComposedComponentProps & {
wrapperComponentProp: number;
@domenkozar
domenkozar / kiosk-chromium.nix
Last active January 24, 2024 14:05
Boot NixOS into chromium kiosk (tested on NixOS 14.04)
services.xserver = {
enable = true;
monitorSection = ''
Option "NODPMS"
'';
serverLayoutSection = ''
Option "BlankTime" "0"
Option "DPMS" "false"
'';
displayManager.auto.user = "guest";
@pvik
pvik / smartparens-cheatsheet.md
Last active March 17, 2024 03:29
A Cheatsheet for Emacs Smarparens example configuration

An animated cheatsheet for smartparens using the example configuration specified here by the smartparens author. Inspired by this tutorial for paredit.

Traversal

C-M-f sp-forward-sexp
C-M-b sp-backward-sexp
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p jq less
nix-instantiate --eval --strict -E 'map (x: x.name) (import <nixpkgs/nixos> {}).config.environment.systemPackages' --json | jq -r '.[]' | sort -u | less
@LnL7
LnL7 / configure.sh
Last active June 9, 2020 20:13
darwin nix-daemon distributed builds
#!/usr/bin/env bash
sudo mkdir -p /run/nix/current-load
sudo launchctl unload /Library/LaunchDaemons/org.nixos.nix-daemon.plist
sudo rm /Library/LaunchDaemons/org.nixos.nix-daemon.plist
sudo curl -fsSL -o /Library/LaunchDaemons/org.nixos.nix-daemon.plist https://gist.github.com/LnL7/ba2eac19e77cd6b4bb02c8de03bf5f4e/raw/69722c2b13c4eb022a1312cd6891838b413e1f96/org.nixos.nix-daemon.plist
sudo launchctl load /Library/LaunchDaemons/org.nixos.nix-daemon.plist
# Configure /etc/nix/machines
# Make sure root can ssh to the builder (known_hosts etc.)
@posener
posener / go-table-driven-tests-parallel.md
Last active April 4, 2024 19:45
Be Careful with Table Driven Tests and t.Parallel()

Be Careful with Table Driven Tests and t.Parallel()

We Gophers, love table-driven-tests, it makes our unittesting structured, and makes it easy to add different test cases with ease.

Let’s create our table driven test, for convenience, I chose to use t.Log as the test function. Notice that we don't have any assertion in this test, it is not needed to for the demonstration.

func TestTLog(t *testing.T) {
	t.Parallel()
@ncochard
ncochard / babel-webpack.md
Last active September 29, 2023 05:15
The correct way to compile ES6 using babel...

When you create a npm package, remember it might be used in a browser or a server, or even a command line utility… For each package you create, please pay attention at what it will be used for:

  1. Is it going to be used as a dependency to a nodejs application that is not bundled? (e.g. command line utilities)
  2. Is it going to be used as a dependency to a nodejs application that is bundled? (e.g. AWS Lambdas)
  3. Is it going to be used as a dependency to a browser application (always bundled)?.
  • In cases 2) and 3) you want to allow for tree shaking.
  • In cases 1) and 2) you want to benefit from the "ES6"/"ES next" features supported natively by nodejs.
  • In case 3) you also want to benefit from the native support of "ES6" from your browser.