Skip to content

Instantly share code, notes, and snippets.

@t3dotgg
t3dotgg / try-catch.ts
Last active April 20, 2025 20:13
Theo's preferred way of handling try/catch in TypeScript
// Types for the result object with discriminated union
type Success<T> = {
data: T;
error: null;
};
type Failure<E> = {
data: null;
error: E;
};
@reynaldichernando
reynaldichernando / cors-proxies.md
Last active March 30, 2025 07:21
CORS Proxies (Updated 2025)

CORS Proxies (Updated 2025)

Free

Proxy (A-Z) Methods Status Code Override Headers Exposed Headers Follow Redirect Timeout Size Limit Rate Limit
allorigins ✅ All ❌ (Always 200) 20/min
cloudflare-cors-anywhere ✅ All ✅ Mirror
codetabs ❌ (only GET) ❌ (Always 200) 625KB 5/sec
cors-anywhere ✅ All ✅ Mirror ✅ (max. 5) 50/3 mins
@Dobby89
Dobby89 / Commands.md
Last active April 9, 2024 12:29
Jest / React Testing Library

Only run tests against files which have been changed (--passWithNoTests used in case no tested files have changed)

jest --onlyChanged --passWithNoTests
@Dobby89
Dobby89 / helpers.md
Last active December 6, 2024 09:32
Typescript snippets

Helpers

Get a unique array

An array of primitives

[...new Set([1, 1, 2, 3])] // [1, 2, 3]
@Dobby89
Dobby89 / Productivity.md
Last active April 10, 2025 06:28
Tips & tricks for productivity / workflow

Windows

Tips

  • Remove desktop background (if your company enforces one)
    • If you search in the start menu for Ease of Access, you'll see a result for Ease of Access brightness setting.
    • Once that settings page has been opened, if you scroll down to the bottom, you’ll see an option to Show desktop background image. If you toggle this to off, it will set the background to the default black.

Keyboard shortcuts

@yagudaev
yagudaev / cypress_support_hooks.js
Last active September 16, 2021 08:46
Cypress Fetch Support Workaround - replaces fetch request with traditional XHR so cypress can track them
// cypress/support/hooks.js
// Cypress does not support listening to the fetch method
// Therefore, as a workaround we polyfill `fetch` with traditional XHR which
// are supported. See: https://github.com/cypress-io/cypress/issues/687
enableFetchWorkaround()
// private helpers
function enableFetchWorkaround() {
let polyfill
@nardan
nardan / nuke-modules.ps1
Last active March 18, 2020 07:50
Deleting Node Modules
Get-ChildItem -Path "." -Include "node_modules" -Recurse -Directory | Remove-Item -Recurse -Force
function makeIndex() {
return Math.random().toString(12).substring(2, 12);
}
function Awesome() {
Object.defineProperty(this, 'index', {
writable: false,
configurable: false,
value: makeIndex()
});
@agorilla
agorilla / _map-get-next.scss
Last active March 7, 2020 11:01
Sass function map-get-next
/// Function to get next map item
/// returns next map item or fallback value if map, key or next item does not exist
/// Github Repo: https://github.com/elcheio/sass-map-get-next-prev
/// Node Module: https://www.npmjs.com/package/sass-map-get-next-prev
///
/// @author Simon Koch <[email protected]>
///
/// Licensed under the MIT license.
///
/// @access public