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 May 14, 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)
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 May 16, 2019
Babel 7.0 with .babelrc.js
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 Mar 28, 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 Mar 11, 2019
BEMIT Cheatsheet
View README.md
@yoavniran
yoavniran / ultimate-ut-cheat-sheet.md
Last active May 20, 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 Feb 20, 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 May 22, 2019
The introduction to Reactive Programming you've been missing
View introrx.md
@timknight
timknight / breakpoint.scss
Created May 5, 2014
A simple responsive breakpoint mixin that takes both attribute names and custom widths. See https://medium.com/p/889927b37740/
View breakpoint.scss
@mixin breakpoint($min: 0, $max: 0) {
$type: type-of($min);
@if $type == string {
@if $min == xs {
@media (max-width: 767px) { @content; } // Mobile Devices
}
@else if $min == sm {
@media (min-width: 768px) { @content; } // Tablet Devices
@substack
substack / test.js
Created Mar 15, 2014
setup and teardown in tape
View test.js
var test = require('tape');
test('setup', function (t) {
// ...
t.end();
});
// tests go here
test('teardown', function (t) {
You can’t perform that action at this time.