Skip to content

Instantly share code, notes, and snippets.

Avatar
🎉
🎉

Jake Teton-Landis justjake

🎉
🎉
View GitHub Profile
@mogelbrod
mogelbrod / portal.js
Last active May 22, 2020
Non-bubbling React Portals
View portal.js
import PropTypes from 'prop-types'
import React from 'react'
import ReactDOM from 'react-dom'
function portalContainer() {
return document.getElementById('portal-container')
}
// Taken from https://reactjs.org/docs/events.html
@bvaughn
bvaughn / example.jsx
Last active Aug 1, 2022
Advanced example for manually managing subscriptions in an async-safe way using hooks
View example.jsx
import React, { useMemo } from "react";
import useSubscription from "./useSubscription";
// In this example, "source" is an event dispatcher (e.g. an HTMLInputElement)
// but it could be anything that emits an event and has a readable current value.
function Example({ source }) {
// In order to avoid removing and re-adding subscriptions each time this hook is called,
// the parameters passed to this hook should be memoized.
const subscription = useMemo(
() => ({
View rtorrent
#!/bin/sh
#
# $FreeBSD$
#
# Runs as unprivileged user "rtorrent"
# Lives in "tmux" (like "screen") because rtorrent can't daemonize itself
# To access rtorrent client that's in the tmux: su - rtorrent && tmux attach
# To detach the tmux and leave rtorrent running: Ctrl-B then D
# nice'd default +10 step to make it go easy on the machine
# Don't forget to put rtorrent_enable="YES" in your /etc/rc.conf
@jewelsea
jewelsea / LayoutAnimator.java
Last active May 24, 2020 — forked from teyc/LayoutAnimator.java
Animates transitions involved when relaying out nodes in a FlowPane
View LayoutAnimator.java
import javafx.animation.Transition;
import javafx.beans.property.DoubleProperty;
import javafx.beans.value.*;
import javafx.collections.*;
import javafx.event.*;
import javafx.scene.Node;
import javafx.scene.transform.Translate;
import javafx.util.Duration;
import java.util.*;