Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Hello World!

Tyler Buchea tylerbuchea

💭
Hello World!
View GitHub Profile
@tylerbuchea
tylerbuchea / digital-ocean-ghost-blog-update.md
Last active Mar 6, 2020
Digital Ocean Ghost Blog Update
View digital-ocean-ghost-blog-update.md

I used Digital Ocean's One-Click install for Ghost blog some time ago and then I wanted to update it. It ended up being more work then I'd hoped so hopefully this helps someone.

If you get locked out

# If you get locked out of your droplet:
# 1. upload your ~/.ssh/id_rsa.pub file to Dropbox
# 2. Then reset Digital Ocean root password
# 3. Login through the Digital Ocean web console using new password
@tylerbuchea
tylerbuchea / textNodesUnder.js
Last active Nov 23, 2019
Get all text values under a specific node
View textNodesUnder.js
function textNodesUnder(node){
const all = [];
for (node = node.firstChild; node; node = node.nextSibling){
if (node.nodeType === 3) all.push(node);
else all = all.concat(textNodesUnder(node));
}
return all;
}
let selector = '';
@tylerbuchea
tylerbuchea / example.js
Created May 18, 2019 — forked from nicolashery/example.js
Combine a pipe of multiple Node.js streams into one stream
View example.js
var util = require('util')
, Transform = require('stream').Transform
, StreamCombiner = require('./streamcombiner');
var chunks1 = [];
var stream1 = new Transform();
var soFar = '';
stream1._transform = function(chunk, encoding, done) {
chunks1.push(chunk.toString());
var pieces = (soFar + chunk).split('\n');
View Copy.js
class Copy {
static language = 'en';
static languageMap = {
en: { Hello: 'Hello' },
sp: { Hello: 'Hola' },
};
set language(language) {
Copy.language = language;
}
View redux.js
// First install decorator plugin: yarn install core-decorators
//
// Then add the plugin to your .babelrc:
// {
// ...
// "env": {
// "development": {
// "plugins": [
// ...
// "transform-decorators-legacy"
View Issue Leaderboard Tracker Product Feedback
# Type queries into this side of the screen, and you will
# see intelligent typeaheads aware of the current GraphQL type schema,
# live syntax, and validation errors highlighted within the text.
# We'll get you started with a simple query showing your username!
query {
repositoryOwner(login:"facebook"){
repository(name:"react") {
id
name
@tylerbuchea
tylerbuchea / combineContext.js
Created Mar 28, 2018 — forked from etienne-dldc/combineContext.js
A small function to combine react Contexts.
View combineContext.js
import React from 'react';
function onlyChild(children) {
return Array.isArray(children) ? children[0] : children;
}
export function combineContext(contexts) {
class Provider extends React.Component {
render() {
const init = this.props.children;
@tylerbuchea
tylerbuchea / invisible-recpatcha.md
Last active Jan 13, 2018
Google Invisible reCAPTCHA Client & Server Example
View invisible-recpatcha.md

The documentation is sparse below is a simple working example of a Invisible reCAPTCHA client server setup using client side JavaScript and a NodeJS server.

This example is setup as a very simple voting API endpoint where you POST your email along with your reCAPTCHA response. The API will return a different message along with the submitted email depending on wether you passed the reCAPTCHA challenge or not.

Invisible HTML component

<html>
<head>
  <script src="https://www.google.com/recaptcha/api.js"></script>
@tylerbuchea
tylerbuchea / docker-compose-single-host.yml
Created Jan 8, 2018
Docker Compose Single Host NGINX Proxy
View docker-compose-single-host.yml
version: "3.2"
services:
nginx-proxy:
image: jwilder/nginx-proxy
ports:
- "3000:80" # change to "80:80" for production
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
@tylerbuchea
tylerbuchea / provision.sh
Last active Jan 3, 2018
Provision Docker Swarm on Digital Ocean
View provision.sh
#!/bin/bash
set -e
# Must fill these values out for the script to work
droplet_name=""
digitalocean_access_token=""
# For more info check out:
# Dockers Machine Digital Ocean Driver: https://docs.docker.com/machine/drivers/digital-ocean/#options
# Docker Swarm: https://docs.docker.com/engine/swarm/