Skip to content

Instantly share code, notes, and snippets.

Avatar

Dustin Deus StarpTech

View GitHub Profile
@pdxjohnny
pdxjohnny / .gitignore
Last active Jul 26, 2020
Setting Up k3s for Serverless (knative) on a $5 DigitalOcean Droplet Using k3d
View .gitignore
.terraform/
*.pem
*.tf
*.tfstate
*.yaml
*.backup
istio-*/
cert-manager-*/
*.swp
env
@jaydenseric
jaydenseric / RouteIndicator.mjs
Last active Jul 17, 2020
A route change indicator for Next.js using React hooks.
View RouteIndicator.mjs
import Router from 'next/router'
import React from 'react'
const DONE_DURATION = 250
export const RouteIndicator = () => {
const [loading, setLoading] = React.useState(null)
const [timeoutId, setTimeoutId] = React.useState(null)
const onLoad = () => setLoading(true)
@bvaughn
bvaughn / index.md
Last active Aug 3, 2020
How to use profiling in production mode for react-dom
View index.md
View html-cache.js
const stream = require('stream')
const cache = new Map() // you might wanna use an lru here
function createCacheStream (url) {
const buf = []
return stream.Transform({
transform: function (data, enc, cb) {
buffer.push(data)
cb(null, data)
},
@pteich
pteich / main.go
Last active Aug 5, 2020
Example for using go's sync.errgroup together with signal detection signal.Notify to stop all running goroutines
View main.go
package main
import (
"context"
"errors"
"fmt"
"os"
"os/signal"
"syscall"
"time"
@nodkz
nodkz / .babelrc.js
Last active Aug 6, 2020
Babel 7.0 with .babelrc.js DEPRECATED! This config was created when babel 7 was in beta
View .babelrc.js
/* eslint-disable prefer-template */
const path = require('path');
const aliases = require('./aliases');
// ///////////////////////////////////////////////////////////////
// ////////////////// PLUGINS ////////////////////////////////
// ///////////////////////////////////////////////////////////////
const commonPlugins = [
@jashmenn
jashmenn / self-eq-this-vs-bind.md
Last active Jul 31, 2020
Javascript var self = this; vs. .bind
View self-eq-this-vs-bind.md

The Problem

In Javascript this is bound in unexpected ways. Functions, in particular, create a new 'this' and so when you want to keep a reference to an "outer" object you sometimes see the pattern:

var self = this;

as in:

var self = this;
@stephenway
stephenway / README.md
Last active Aug 8, 2020
BEMIT Cheatsheet
View README.md
View bashstyle.md

progrium/bashstyle

Bash is the JavaScript of systems programming. Although in some cases it's better to use a systems language like C or Go, Bash is an ideal systems language for smaller POSIX-oriented or command line tasks. Here's three quick reasons why:

  • It's everywhere. Like JavaScript for the web, Bash is already there ready for systems programming.
  • It's neutral. Unlike Ruby, Python, JavaScript, or PHP, Bash offends equally across all communities. ;)
  • It's made to be glue. Write complex parts in C or Go (or whatever!), and glue them together with Bash.

This document is how I write Bash and how I'd like collaborators to write Bash with me in my open source projects. It's based on a lot of experience and time collecting best practices. Most of them come from these two articles, but here integrated, slightly modified, and focusing on the most bang for buck items. Plus some ne

@yoavniran
yoavniran / ultimate-ut-cheat-sheet.md
Last active Aug 6, 2020
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai and Sinon
View ultimate-ut-cheat-sheet.md

The Ultimate Unit Testing Cheat-sheet

For Mocha, Chai and Sinon

using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies


You can’t perform that action at this time.