Skip to content

Instantly share code, notes, and snippets.

// Node style module writ in ES6 syntax:
exports default foo = () => console.log(‘hi’)
// Unfortunately “literally” transpiles to this:
exports.default = function foo() {
return console.log(‘hi’)
}
// Which means this will fail:
var foo = require(‘./foo’)
// Node style module writ in ES6 syntax:
export default foo = () => console.log(‘hi’)
// Unfortunately “literally” transpiles to this:
exports.default = function foo() {
return console.log(‘hi’)
}
// Which means this will fail:
var foo = require(‘./foo’)
@mlocati
mlocati / win10colors.cmd
Last active May 6, 2024 09:03
ANSI Colors in standard Windows 10 shell
@echo off
setlocal
call :setESC
cls
echo %ESC%[101;93m STYLES %ESC%[0m
echo ^<ESC^>[0m %ESC%[0mReset%ESC%[0m
echo ^<ESC^>[1m %ESC%[1mBold%ESC%[0m
echo ^<ESC^>[4m %ESC%[4mUnderline%ESC%[0m
@kenzieschmoll
kenzieschmoll / main.dart
Created May 10, 2022 23:30
two way communication with iframe in Flutter Web app
import 'dart:async';
import 'dart:html' as html;
import 'dart:ui' as ui;
import 'package:flutter/material.dart';
void main() {
final controller = Controller()..init();
runApp(EmbeddedIFrameExample(controller));
}
@arkatsy
arkatsy / zustand-internals.jsx
Last active May 6, 2024 09:02
How zustand works internally
import { useSyncExternalStore } from "react";
// For more on the useSyncExternalStore hook, see https://react.dev/reference/react/useSyncExternalStore
// The code is almost identical to the source code of zustand, without types and some features stripped out.
// Check the links to see the references in the source code.
// The links are referencing the v5 of the library. If you plan on reading the source code yourself v5 is the best way to start.
// The current v4 version contains lot of deprecated code and extra stuff that makes it hard to reason about if you're new to this.
// https://github.com/pmndrs/zustand/blob/fe47d3e6c6671dbfb9856fda52cb5a3a855d97a6/src/vanilla.ts#L57-L94
function createStore(createState) {
/********************
* theLongWayOut.js *
********************
*
* Well, it looks like they're on to us. The path isn't as
* clear as I thought it'd be. But no matter - four clever
* characters should be enough to erase all their tricks.
*/
function startLevel(map) {
@noraj
noraj / gulp-cjs-to-esm.md
Last active May 6, 2024 09:01
Moving gulpfile from CommonJS (CJS) to ECMAScript Modules (ESM)

Moving gulpfile from CommonJS (CJS) to ECMAScript Modules (ESM)

Context

del v7.0.0 moved to pure ESM (no dual support), which forced me to move my gulpfile to ESM to be able to continue to use del.

The author sindresorhus maintains a lot of npm packages and does not want to provides an upgrade guide for each package so he provided a generic guide. But this guide is a bit vague because it's generic and not helping for gulp, hence this guide.

Guide

@jamesmacwhite
jamesmacwhite / Workarounds for Netflix and the blocking of IPv6 tunnels.md
Last active May 6, 2024 09:00
Prevent proxy/VPN streaming error messages from Netflix when using a Hurricane Electric IPv6 tunnel.

Workarounds for Netflix and the blocking of Hurricane Electric IPv6 tunnels

The dreaded "You seem to be using an unblocker or proxy." error message. Cool story bro.

This gist was essentially created out of my own rant about Netflix being hostile to IPv6 tunnel services since June 2016. You are welcome to read my opinion on the matter, this is the more technical side to the issue and how to combat it within your own network.

Since I wrote this, various GitHub users have contributed their thoughts and ideas which has been incorporated into this gist. Thank you to everyone who have contributed their own methods and implementations.

The problem

Netflix now treats IPv6 tunnel brokers (such as Hurricane Electric) as proxy servers. A while ago it became apparent to users and Netflix that somewhat by accident, IPv6 tunnel users were being served content outside of their geolocation because of the way Netflix was identifyi

@zthxxx
zthxxx / Activate Office 2019 for macOS VoL.md
Last active May 6, 2024 08:58
crack activate Office on mac with license file
@Chick3nman
Chick3nman / RTX_4090_v6.2.6.Benchmark
Created October 14, 2022 00:07
Hashcat v6.2.6 benchmark on the Nvidia RTX 4090
NVIDIA Driver Version: 522.25 CUDA Version: 11.8
Credit: blazer
For benchmarking the card and allowing me to release the benchmarks here
The hashcat installation used includes a change to the tuning ALIAS.hctune file to include the RTX 4090 as "ALIAS_nv_sm50_or_higher".
The "Kernel exec timeout" warning is cosmetic and does not affect the speed of any of the benchmarked modes.
Benchmark was run at stock clocks on an Asus Strix 4090.