Skip to content

Instantly share code, notes, and snippets.

@finas
finas / RemoteComponentDemo.tsx
Last active May 31, 2023 02:14
Load remote bundled react component.
import React from 'react';
export function useRemoteComponent<T>(url: string, componentName: string = 'RulesUI') {
const ref = React.useRef({
url: '',
component: null as unknown as React.FC<T>,
});
const [update, setUpdate] = React.useState(true);
React.useEffect(() => {
if (!url) {
return;
type AnyFunction = (...args: any[]) => any
function useEvent<T extends AnyFunction>(callback?: T) {
const ref = useRef<AnyFunction | undefined>(() => {
throw new Error("Cannot call an event handler while rendering.")
})
// Or useInsertionEffect if it's React 18
useLayoutEffect(() => {
ref.current = callback
})
@finas
finas / remap-capslock-to-control-win10.md
Created August 17, 2022 03:04 — forked from joshschmelzle/remap-capslock-to-control-win10.md
Remap Caps Lock to Control on Windows 10

Ways to remap caps lock to control on Windows 10

These methods in this gist worked for me on my U.S.-based keyboard layouts. I am unsure about other layouts. If you have problems, revert your changes; delete the registry key you created (and reboot).

Update: you should probably scroll down to approach 4 where I suggest using Microsoft PowerToys Keyboard Manager.

Approach 1. Manually through regedit

Navigate to and create a new binary value in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout named Scancode Map.

@finas
finas / setup_cypress_wsl2.md
Created August 5, 2022 08:47 — forked from pjobson/setup_cypress_wsl2.md
Setting Up Cypress on Ubuntu WSL2

Setting Up Cypress on Ubuntu WSL2

No clue why the directions for this are buried deep in WLS issues. This is how I setup my Cypress on Ubuntu WSL2 working for both on and off VPN with some corp firewall.

Before executing any command, be sure to read and understand it, I ask you to run two shell scripts which I wrote. You should review any shell script provided by anyone before blindly running it. I'm not doing anyting bad, but I advise you to check for yourself.

Dependencies

sudo apt install libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev \

libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb \

@finas
finas / AndroidEmulator.md
Created August 5, 2022 02:44 — forked from Try-Parser/AndroidEmulator.md
Running emulator without Android Studio in Windows With Flutter

Android Emulator Setup without Android Studio in Windows with Flutter

First Download the Android SDK Commandline Tool only.

https://developer.android.com/studio/

Goto Download Options

Find Commandline tools only Section

@finas
finas / System Design.md
Created November 26, 2021 01:16 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@finas
finas / GitCommitEmoji.md
Created November 26, 2021 01:12 — forked from parmentf/GitCommitEmoji.md
Git Commit message Emoji
@finas
finas / GitCommitEmoji.md
Created November 26, 2021 01:12 — forked from parmentf/GitCommitEmoji.md
Git Commit message Emoji
@finas
finas / gist:ce3ff09da759b8d618cfee412d0d2d1c
Created July 3, 2021 05:39 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@finas
finas / curl.sh
Created June 21, 2021 12:55 — forked from 1901/curl.sh
[curl] #linux #curl #network
# 使用指定的 Host 访问某个地址
curl -w "@curl_format.txt" -H 'Host: www.baidu.com' 'http://127.0.0.1'
# 用于分析请求耗时
curl -w "@curl_format.txt" 'http://127.0.0.1'
# 设置超时
curl --connect-timeout 1 --max-time 3 "http://www.baidu.com"