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 / gen_random_alphanum.dart
Created January 16, 2022 16:48
Create random alphanumeric string
/// 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))
)
);
@gugadev
gugadev / next.config.js
Created October 29, 2021 15:57 — forked from skolhustick/next.config.js
next-js-pwa-setup
const withPWA = require('next-pwa')
module.exports = withPWA({
pwa: {
dest: 'public'
}
})
@gugadev
gugadev / flutter-setup-windows-guide.md
Created June 13, 2021 19:10
Guide to setup flutter and android on Windows 10

Flutter setup Windows guide

No requires Android Studio 🥳



@gugadev
gugadev / environment.ts
Created May 13, 2021 16:22
Utilitary for get environment variables in CRA.
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);
@gugadev
gugadev / readme.md
Created November 30, 2020 18:31
How to use Sonarlint with your cloud configuration

Sonarlint y Code

Instalar Sonarlint

Lo primero es instalar la extensión Sonarlint en nuestro Code.

Crear un token

@gugadev
gugadev / fluid.spec.ts
Last active November 17, 2020 14:06
Fluid - An small utility to do basic querying on arrays of objects
interface User {
name: string;
age: number;
birthDate: Date;
admin: boolean;
foo?: {
bar: string;
}
}
import React, { useState } from "react";
const JitsiMeet = () => {
const [jitsi, setJitsi] = useState<JitsiInstance | null>(null);
return null;
}
@gugadev
gugadev / what-forces-layout.md
Created September 14, 2020 23:04 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@gugadev
gugadev / launch.json
Created February 2, 2020 14:43 — forked from cecilemuller/launch.json
Run ts-node in VSCode Debugger
{
"version": "0.2.0",
"configurations": [
{
"name": "Node Inspector",
"type": "node",
"request": "launch",
"args": ["${workspaceRoot}/src/service.ts"],
"runtimeArgs": ["-r", "ts-node/register"],
"cwd": "${workspaceRoot}",
@gugadev
gugadev / flatten-array.js
Created January 21, 2020 18:03
Flatten an array with n deep levels.
const source = [[1, 2, [3, [4]]], 5]
const flatArray = (src) => {
const flattened = []
function isArray(value) {
return value instanceof Array
}
// do not modify the original array, instead, clone it