Skip to content

Instantly share code, notes, and snippets.

Avatar
👀
Open to new opportunities

Glenn 'devalias' Grant 0xdevalias

👀
Open to new opportunities
View GitHub Profile
@goran-peoski-work
goran-peoski-work / lazy.ts
Last active Jul 7, 2021
Dynamic import of omponent
View lazy.ts
import React, { ComponentType, LazyExoticComponent } from "react";
type Transformer = <T>(name: keyof T) => (module: T) => { default: T[keyof T] };
const transformer: Transformer = (
(name) => (module) => ({ default: module[name] })
);
@djs55
djs55 / docker-desktop-mutagen-builds.md
Last active Jul 25, 2020
Development builds containing the Docker Desktop + Mutagen integration
View docker-desktop-mutagen-builds.md

This is a list of Docker Desktop for Mac development builds which contain mutagen. These are based on Edge, but may contain unexpected bugs. They should be used for testing the Mutagen feature rather than for production work.

2020-07-14: development snapshot: https://desktop-stage.docker.com/mac/edge/46638/Docker.dmg

  • Exclude files from a mutagen sync based on the .dockerignore file.
  • Flush around docker exec as well as docker run for more reliable scripting.
  • Fix a bug which could result in duplicates in the list of synchronised directories.
  • Allow the sync to be bypassed by using :consistent or :cached. In particular this means if you want the previous :delegated behaviour before mutagen, switch to :cached. This
View Keybase
### Keybase proof
I hereby claim:
* I am moloch-- on github.
* I am moloch (https://keybase.io/moloch) on keybase.
* I have a public key whose fingerprint is 0E59 543B A7BC 269F 3AAE 707E B705 0578 9B38 EEA6
To claim this, I am signing this object:
@zachboyd
zachboyd / AWSSubscriptionClient.ts
Last active Jul 28, 2021
Appsync Subscription support for subscriptions-transport-ws
View AWSSubscriptionClient.ts
import { uniqBy } from 'lodash';
import { ClientOptions, SubscriptionClient } from 'subscriptions-transport-ws';
export class AWSSubscriptionClient extends SubscriptionClient {
constructor(
url: string,
options?: ClientOptions,
webSocketImpl?: any,
webSocketProtocols?: string | string[]
) {
@jacobmix
jacobmix / SyncLoungeDockerGuide.md
Last active Apr 21, 2020
SyncLounge Docker guide
View SyncLoungeDockerGuide.md

Here's how you set up on SyncLounge with Docker (Now with Markdown):
First make sure you got the Docker Hub in your registry:
Regisry

Download the latest SyncLounge image:
Image

Launch the image, and go to advanced settings:
Create Container

@joecot
joecot / synclounge-selfhosted-nodocker.md
Last active Apr 4, 2021
Synclounge Selfhosted Without Docker
View synclounge-selfhosted-nodocker.md

Self Hosted SyncLounge (without Docker)

This is a quick howto for self-hosting SyncLounge, a useful tool for hosting watch parties for your Plex server.

If you just want to host a plex party, you can use the public synclounge.tv server. If you want to use Docker instead of mucking about with Node, the SyncLounge readme describes it. This is for running the NodeJS yourself.

You don't need programming experience to set SyncLounge up, but without a passable experience configuring linux, you're probably better off using synclounge.tv instead.

Server Pre-Reqs

@slikts
slikts / advanced-memo.md
Last active Sep 23, 2021
Advanced memoization and effects in React
View advanced-memo.md

nelabs.dev

Advanced memoization and effects in React

Memoization is a somewhat fraught topic in the React world, meaning that it's easy to go wrong with it, for example, by [making memo() do nothing][memo-pitfall] by passing in children to a component. The general advice is to avoid memoization until the profiler tells you to optimize, but not all use cases are general, and even in the general use case you can find tricky nuances.

Discussing this topic requires some groundwork about the technical terms, and I'm placing these in once place so that it's easy to skim and skip over:

  • Memoization means caching the output based on the input; in the case of functions, it means caching the return value based on the arguments.
  • Values and references are unfortunately overloaded terms that can refer to the low-level implementation details of assignments in a language like C++, for example, or to memory
@slikts
slikts / react-memo-children.md
Last active Sep 20, 2021
Why using the `children` prop makes `React.memo()` not work
View react-memo-children.md

nelabs.dev

Why using the children prop makes React.memo() not work

I've recently ran into a pitfall of [React.memo()][memo] that seems generally overlooked; skimming over the top results in Google just finds it mentioned in passing in a [React issue][regit], but not in the [FAQ] or API [overview][react-api], and not in the articles that set out to explain React.memo() (at least the ones I looked at). The issue is specifically that nesting children defeats memoization, unless the children are just plain text. To give a simplified code example:

const Memoized = React.memo(({ children }) => (<div>{children}</div>));
// Won't ever re-render
<Memoized>bar</Memoized>
// Will re-render every time; the memoization does nothing
@jfcherng
jfcherng / st4-changelog.md
Last active Sep 5, 2021
Sublime Text 4 changelog just because it's not on the official website yet.
View st4-changelog.md
@pftg
pftg / Yarn Upgrade Indirect Dependencies.md
Last active Feb 4, 2021
Update indirect dependencies in yarn.lock. `ruby rejuvenation.rb & yarn install`
View Yarn Upgrade Indirect Dependencies.md
$> curl "https://gist.githubusercontent.com/pftg/fa8fe4ca2bb4638fbd19324376487f42/raw/f9056244c416d2f56d6d94290e5ecef5960abf66/rejuvenation.rb" | ruby

or

$> ruby rejuvenation.rb
$> yarn install