Skip to content

Instantly share code, notes, and snippets.

@acburdine
acburdine / README.md
Created May 22, 2020 19:17
stderr piping repro case

in one terminal window, run node parent.js in another, run tail -f test.log

with the cp.stderr.destroy line commented out, the node parent.js process will not automatically exit. With the cp.stderr.destroy line uncommented, the parent process correctly exits and the child process is unaffected.

@acburdine
acburdine / README.md
Last active April 25, 2019 11:35
React useState hook with debounce

React useDebouncedState hook

Why?

I was building a component that did address autocompletion against a GraphQL endpoint using react-apollo. The value of the input field was used to search for addresses, but I didn't want every single keystroke to result in a new GraphQL query. So, I needed some sort of debounce function (Apollo doesn't provide this natively).

While I could have used a class component for something like this, I wanted to see if it could be done more simply with Hooks. This is what I came up with.

@acburdine
acburdine / init.sh
Created November 16, 2017 13:22
ghost-cli-droplet-init
#!/bin/bash
# Upgrade things initially
apt update && apt upgrade -y
# Add Yarn repo
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
# Install NodeJS 8 package repo (runs apt update in the script which is why we add yarn first)
@acburdine
acburdine / keybase.md
Created September 9, 2017 03:22
keybase verification

Keybase proof

I hereby claim:

  • I am acburdine on github.
  • I am acburdine (https://keybase.io/acburdine) on keybase.
  • I have a public key ASC1eFR6Lslrw67L_rIp3mkflwflYD0rgB4rK_amb9jVnQo

To claim this, I am signing this object:

@acburdine
acburdine / .travis.yml
Created January 17, 2017 01:43
Adding Yarn to Travis CI
addons:
apt:
sources:
- sourceline: 'deb https://dl.yarnpkg.com/debian/ stable main'
key_url: 'https://dl.yarnpkg.com/debian/pubkey.gpg'
packages:
- yarn
install:
- yarn
@acburdine
acburdine / controllers.application.js
Last active October 28, 2016 18:21
Ember-Sortable re-order items
import Ember from 'ember';
const {computed} = Ember;
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
sortdef: ['id'],
sortedModel: computed.sort('model', 'sortdef'),
@acburdine
acburdine / controllers.application.js
Created September 23, 2016 15:02
ember 2.8 controller bug
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@acburdine
acburdine / controllers.application.js
Created July 29, 2016 22:58
Ember 2.7 demo for bug
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@acburdine
acburdine / controllers.application.js
Created July 29, 2016 22:56
Ember 2.6 Demo for bug
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@acburdine
acburdine / gist:0932ba786277ccc47230
Created April 7, 2015 21:47
error occurring in handlebars template
<section class="content settings-pass">
<form id="settings-pass" novalidate="novalidate">
<fieldset>
<div class="form-group for-checkbox">
<label for="blog-isPrivate">Make this blog private</label>
<label class="checkbox" for="blog-isPrivate">
{{input id="blog-isPrivate" name="labs[passProtectUI]" type="checkbox"
checked=model.isPrivate}}
<span class="input-toggle-component"></span>
<p>Enable password protection</p>