No requires Android Studio 🥳
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class Environment { | |
static string(varName: string, defaultValue = ""): string { | |
const value = process.env[`REACT_APP_${varName}`]; | |
return value ?? defaultValue; | |
} | |
static int(varName: string, defaultValue = 0): number { | |
const value = process.env[`REACT_APP_${varName}`]; | |
if (value) { | |
return Number.parseInt(value, 10); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const withPWA = require('next-pwa') | |
module.exports = withPWA({ | |
pwa: { | |
dest: 'public' | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Courtesy of https://stackoverflow.com/a/61929967/10670707 | |
Future<String> genRandomAlphanumeric(int length) async { | |
const _chars = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890'; | |
Random _rnd = Random(); | |
return String.fromCharCodes( | |
Iterable.generate( | |
length, | |
(_) => _chars.codeUnitAt(_rnd.nextInt(_chars.length)) | |
) | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:math'; | |
void main() async { | |
var pwd = await getRandomPwd(8); | |
print(pwd); | |
} | |
Future<String> getRandomPwd(int length) async { | |
if (length > 62) { | |
throw Error('The max length of the password could be 62'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
enum DialogButtonStyle { | |
PRIMARY, | |
SECONDARY, | |
} | |
void main() { | |
runApp(App()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"to": "token o topic", | |
"priority": "high", | |
"notification": { | |
"title": "Title of the notification", | |
"body": "Description of the notification", | |
"android_channel_id": "Android channel" | |
}, | |
"data": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* * 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 = () => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |