Skip to content

Instantly share code, notes, and snippets.

💭
Hello World!

Tyler Buchea tylerbuchea

💭
Hello World!
Block or report user

Report or block tylerbuchea

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@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/
View await-to-js.js
/**
* @param { Promise } promise
* @param { Object= } errorExt - Additional Information you can pass to the err object
* @return { Promise }
*/
function to(promise, errorExt) {
return promise
.then(function (data) { return [null, data]; })
.catch(function (err) {
if (errorExt) {
@tylerbuchea
tylerbuchea / cloudSettings
Last active Aug 29, 2018
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2018-08-29T15:24:17.471Z","extensionVersion":"v3.1.0"}
You can’t perform that action at this time.