Skip to content

Instantly share code, notes, and snippets.

View cheton's full-sized avatar
🎯

Cheton Wu cheton

🎯
View GitHub Profile
@tannerlinsley
tannerlinsley / README.md
Last active April 12, 2024 17:04
Replacing Create React App with the Next.js CLI

Replacing Create React App with the Next.js CLI

How dare you make a jab at Create React App!?

Firstly, Create React App is good. But it's a very rigid CLI, primarily designed for projects that require very little to no configuration. This makes it great for beginners and simple projects but unfortunately, this means that it's pretty non-extensible. Despite the involvement from big names and a ton of great devs, it has left me wanting a much better developer experience with a lot more polish when it comes to hot reloading, babel configuration, webpack configuration, etc. It's definitely simple and good, but not amazing.

Now, compare that experience to Next.js which for starters has a much larger team behind it provided by a world-class company (Vercel) who are all financially dedicated to making it the best DX you could imagine to build any React application. Next.js is the 💣-diggity. It has amazing docs, great support, can grow with your requirements into SSR or static site generation, etc.

So why

@gurupras
gurupras / distributed-mediasoup.js
Created May 27, 2020 13:41
mediasoup horizontal scaling
onServerStartup () {
const { serverId, ip } = getServerInfo() // serverId does not change across restarts
this.serverId = serverId
// We don't have any routers or producers (yet). Clear any value that exists in the DB related to our serverId
clearSharedDB(serverId, 'routers')
clearSharedDB(serverId, 'producers')
// Update the DB with our serverId and ip so that others will know how to reach us
registerServerInDB(serverId, ip)
@ozbillwang
ozbillwang / Git_Behind_Proxy.md
Last active April 20, 2024 15:58
Configure Git to use a proxy (https or SSH+GIT)
@Justkant
Justkant / i18next-scanner.config.js
Created August 16, 2019 11:37
Scan + merge except for defaultLng, with support for removeUnusedKeys option
/* eslint-disable import/no-extraneous-dependencies */
const _ = require('lodash');
const fs = require('fs');
const eol = require('eol');
const path = require('path');
const VirtualFile = require('vinyl');
const flattenObjectKeys = require('i18next-scanner/lib/flatten-object-keys')
.default;
const omitEmptyObject = require('i18next-scanner/lib/omit-empty-object')
.default;

How we incorporate next and cloudfront (2018-04-21)

Feel free to contact me at robert.balicki@gmail.com or tweet at me @statisticsftw

This is a rough outline of how we utilize next.js and S3/Cloudfront. Hope it helps!

It assumes some knowledge of AWS.

Goals

@edoardocavazza
edoardocavazza / object-setprototypeof-ie9.js
Last active April 12, 2024 14:24
An "Object.setPrototypeOf" polyfill for IE9
// https://gist.github.com/edoardocavazza/47246856759f2273e48b
(function () {
if (typeof Object.setPrototypeOf === 'undefined' && typeof Object.getOwnPropertyNames === 'function') {
var _exclude = ['length', 'name', 'arguments', 'caller', 'prototype'];
function bindFunction(ctx, fn) {
return function() {
return fn.apply(this, arguments);
}
}
@creationix
creationix / init.lua
Last active November 1, 2019 11:13
Websocket server in nodemcu using new crypto module.
wifi.setmode(wifi.STATION)
wifi.sta.config("creationix","noderocks")
wifi.sta.connect()
tmr.alarm(0, 1000, 1, function ()
local ip = wifi.sta.getip()
if ip then
tmr.stop(0)
print(ip)
dofile("websocket.lc")
dofile("main.lc")
@cletusw
cletusw / .eslintrc
Last active February 29, 2024 20:24
ESLint Reset - A starter .eslintrc file that resets all rules to off and includes a description of what each rule does. From here, enable the rules that you care about by changing the 0 to a 1 or 2. 1 means warning (will not affect exit code) and 2 means error (will affect exit code).
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names