Skip to content

Instantly share code, notes, and snippets.

View edgarv09's full-sized avatar

Edgar Villamarin edgarv09

View GitHub Profile
@t3dotgg
t3dotgg / try-catch.ts
Last active July 6, 2025 19:50
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;
};
Change region of Xiaomi routers to unlock all channel:
1. Login to ur router in browser.
2. Open a new tab and paste this
http://192.168.31.1/cgi-bin/luci/;stok=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/api/xqsystem/set_country_code?country=CN
get the stok value from login tab and replace it in new tab and then hit enter.
3. Router will reboot automatically and on next login u will see all 5Ghz channel 36~48 and 149~165.
@searls
searls / do-this.js
Created May 24, 2020 04:05
How to play web audio that won't interrupt background system-wide audio playback in iOS
let audioContext
export function play (url) {
const AudioContext = window.AudioContext || window.webkitAudioContext
if (!audioContext) audioContext = new AudioContext()
const request = new window.XMLHttpRequest()
request.open('GET', url, true)
request.responseType = 'arraybuffer'
request.addEventListener('load', function (e) {
const source = audioContext.createBufferSource()
source.buffer = audioContext.createBuffer(request.response, false)
@tagliala
tagliala / bash.sh
Last active September 30, 2021 21:39
Postgres 11 - Postgis 3 - brew
# Create postgis.control
/usr/local/opt/postgresql@11/share/postgresql@11/extension/postgis.control
# Manually move files to postgres folder
cp /usr/local/Cellar/postgis/3.0.1/lib/*.so /usr/local/Cellar/postgresql@11/11.7/lib
cp /usr/local/Cellar/postgis/3.0.1/share/postgis/*.* /usr/local/Cellar/postgresql@11/11.7/share/postgresql@11/extension
# Pin formuale
@stettix
stettix / things-i-believe.md
Last active June 19, 2025 02:11
Things I believe

Things I believe

This is a collection of the things I believe about software development. I have worked for years building backend and data processing systems, so read the below within that context.

Agree? Disagree? Feel free to let me know at @JanStette.

Fundamentals

Keep it simple, stupid. You ain't gonna need it.

@devnoname120
devnoname120 / My macOS setup.md
Last active June 17, 2025 15:23
My macOS setup

ℹ️ Enable iCloud end-to-end encryption:

  • Nobody knows that, but iCloud actually supports end-to-end encryption (see “Advanced Data Protection for iCloud”) but it's disabled by default. If you care about data privacy, you should turn it on.
    • System settingsApple IDiCloud → Set Advanced Data Protection to On.
    • System settingsApple IDiCloud → Disable Access iCloud Data on the Web.
  • It supports almost all the native Apple apps, with the notable exceptions of iCloud Mail, Contacts, and Calendars. See official data protection matrix for more info.

Table of Contents

@jdnichollsc
jdnichollsc / ABC.md
Last active December 7, 2024 17:45
The Job Interview Guide

The Job Interview Guide 💼

And English is a Work in Progress ⌛

@Rich-Harris
Rich-Harris / what-is-svelte.md
Last active July 4, 2025 21:38
The truth about Svelte

I've been deceiving you all. I had you believe that Svelte was a UI framework — unlike React and Vue etc, because it shifts work out of the client and into the compiler, but a framework nonetheless.

But that's not exactly accurate. In my defense, I didn't realise it myself until very recently. But with Svelte 3 around the corner, it's time to come clean about what Svelte really is.

Svelte is a language.

Specifically, Svelte is an attempt to answer a question that many people have asked, and a few have answered: what would it look like if we had a language for describing reactive user interfaces?

A few projects that have answered this question:

@CodeMaxter
CodeMaxter / auto-setup-scoop.ps1
Created November 15, 2018 06:39
PowerShell script to install a software development environment using scoop package manager
# git
scoop install git
# add the optional 'extras' bucket
scoop bucket add extras
# utils
scoop install colortool cmder 7zip curl sudo coreutils grep cygwin totalcommander nvm paint.net
# colaboration
@withoutwax
withoutwax / ror-api.markdown
Last active May 5, 2025 10:25
Guide on how to create an API-Only Application with Ruby on Rails 5

Creating an API-Only Application with Ruby on Rails

01 - Create a new API-only Rails app

rails new ror-app-name --api

02 - Basic Scaffold

01 - Model

This step is for creating a very basic level of model for us to work in. If you know already, or wish to apply your own custom models with relationships you can skip this step.