Skip to content

Instantly share code, notes, and snippets.

View gugadev's full-sized avatar
🌐
Web & Mobile

Gustavo García gugadev

🌐
Web & Mobile
View GitHub Profile
@gugadev
gugadev / install-android-sdk-windows.md
Last active October 8, 2024 13:13
Install SDK on Windows [without AndroidStudio]

Android SDK setup - Windows guide

If you are a React Native, NativeScript, Flutter or Ionic developer maybe you don't want to install the entire Android Studio just to have your environment ready. If this is your case, this guide will help you to setup your minimal Android SDK environment in Windows.


@gugadev
gugadev / http.ts
Created July 15, 2023 21:54
Small utility to remote data fetching using polymorfism to allow distinct implementations.
/**
* @description Constituye un catálogo de errores de una API.
* Un catálogo es un mapa en donde se asocia un código de error
* con un mensaje describiendo el problema que se ha originado.
* Por ejemplo:
* {
* 24323: 'Ha ocurrido un error consumiendo el servicio externo ABC',
* 13424: 'No se encontraron coincidencias para la búsqueda'
* }
*/
import 'package:flutter/material.dart';
class BottomNavigation extends StatefulWidget<_BottomNavigationState> {
BottomNavigation({
this.children,
this.items,
this.fadeDuration
});
final List<Widget> children;
final List<Widget> items;
@gugadev
gugadev / macOS Internals.md
Created May 12, 2023 13:11 — forked from kconner/macOS Internals.md
macOS Internals

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

@gugadev
gugadev / fetch-response-interceptor.ts
Last active February 26, 2023 14:01
Small proxy based interceptor for fetch. Currently works with Response.prototype.text, Response.prototype.json, Response.prototype.blob and Response.prototype.arrayBuffer.
type InterceptorResponse = Omit<
typeof Response.prototype,
'text' | 'formData' | 'blob' | 'json' | 'arrayBuffer'
>
type FetchInterceptorResponseConfig = {
onUnauthenticated?: (obj: InterceptorResponse) => void
onInternalError?: (obj: InterceptorResponse) => void
onForbidden?: (obj: InterceptorResponse) => void
onRateLimit?: (obj: InterceptorResponse) => void
@gugadev
gugadev / tw-unfollower.js
Created December 9, 2022 00:10
Tiny script to unfollow all people you're following. Just go to https://twitter.com/<youruser>/following, open the console and run the code (testing in responsive mode).
function unfollow() {
let count = 0
const buttons = document.querySelectorAll('[data-testid*="-unfollow"]')
if (!buttons.length) {
console.log(`${count} People unfollowed`)
return
}
const waitFor = (ms) => new Promise(resolve => setTimeout(resolve, ms))
@gugadev
gugadev / sw-service.ts
Last active April 12, 2022 04:17
Vanilla Service Worker
export function register() {
if ("serviceWorker" in navigator) {
return new Promise((resolve) => {
navigator.serviceWorker.register("/sw.js")
.then((registration) => {
registration.onupdatefound = () => {
const worker = registration.active;
if (worker == null) {
return;
}
@gugadev
gugadev / build-sw.js
Last active April 9, 2022 22:47
Service worker examples in TypeScript and JavaScript
/**
* * This is not in use.
* * Para conocimiento general:
* Esta es una forma de generar el "precache manifest"
* de un service worker. La otra forma es como se detalla
* en el script de NPM "sw" en el presente package.json.
*/
const workboxBuild = require("workbox-build");
const buildServiceWorker = () => {
@gugadev
gugadev / legacy.json
Created January 25, 2022 18:33
Migration of the REST payload from legacy to v1 - FCM
{
"to": "token o topic",
"priority": "high",
"notification": {
"title": "Title of the notification",
"body": "Description of the notification",
"android_channel_id": "Android channel"
},
"data": {
@gugadev
gugadev / main.dart
Created January 25, 2022 14:03
Migration from OutlineButton to OutlinedButton.
import 'package:flutter/material.dart';
enum DialogButtonStyle {
PRIMARY,
SECONDARY,
}
void main() {
runApp(App());
}