Skip to content

Instantly share code, notes, and snippets.

Dustin Deus StarpTech

Block or report user

Report or block StarpTech

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
@jaydenseric
jaydenseric / RouteIndicator.mjs
Last active Oct 30, 2019
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 Oct 29, 2019
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)
},
@nodkz
nodkz / .babelrc.js
Last active Sep 30, 2019
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 Nov 8, 2019
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 Oct 29, 2019
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 Nov 12, 2019
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


@ipmb
ipmb / ratelimit.nginxconf
Last active May 23, 2019
Nginx reverse proxy with rate limiting
View ratelimit.nginxconf
upstream myapp {
server 127.0.0.1:8081;
}
limit_req_zone $binary_remote_addr zone=login:10m rate=1r/s;
server {
listen 443 ssl spdy;
server_name _;
@staltz
staltz / introrx.md
Last active Nov 13, 2019
The introduction to Reactive Programming you've been missing
View introrx.md
You can’t perform that action at this time.