Skip to content

Instantly share code, notes, and snippets.

View coxato's full-sized avatar
💻

Carlos Martínez coxato

💻
View GitHub Profile
@coxato
coxato / properNesting.js
Created October 30, 2021 02:59
proper nesting
// Carlos Martinez @coxato
// the problem is about validate and fill a string with square brackets, curly brackets and braces () [] {}
// if you have for example
// "]-(" you have to return "[]-()"
// "[{{" returns "[{{}}]"
// "" returns ""
// "} { [()] (()v()) } ])" returns "([{} { [()] (()v()) } ])"
// "(]" returns null
// "[}}[" returns null
@coxato
coxato / auth.js
Last active June 10, 2021 19:30
Easy firebase (manage firebase easy)
import { auth, firebase } from './init';
import { dbApi } from './dbApi';
class AuthMethods{
async signup({ firstname, lastname, email, password, phone }){
try {
const { user } = await auth.createUserWithEmailAndPassword(email, password);
await dbApi.setDocument('users', user.uid, {
firstname,
lastname,
@coxato
coxato / firestoreAPI.dart
Created January 16, 2021 07:43
firestore: get data from db with dart, and dynamically pass named params - v1
/*
Carlos Martinez 2021
this is a very little library for confortable use of firestore in dart.
version 1.0
*/
import 'package:cloud_firestore/cloud_firestore.dart';
// class for firestore `where` method, this is a trick
// because Dart doest not support pass dynamically named parameters
@coxato
coxato / similitudesReactYFlutter.md
Last active January 8, 2021 05:23
React and flutter similarities [spanish]

haciendo una app en flutter

Flutter funciona de manera muy parecida a react.js de hecho, usa el mismo concepto de componentes con estado y componentes sin estado. Solo en vez de llamarse "componentes" en flutter se les llama "widgets", y asi como en react todo es un componente, pues aqui lo mismo, todo en flutter es un widget.

Hay muchas maneras de darle forma y estilo a una app de flutter y la más común de todas es usar los paquetes que vienen por defecto de package:flutter/material.dart, el cual no es mas que muchisimos elementos y widgets de la librería Material Design. Digamos que es el

@coxato
coxato / mongoSingleton.js
Last active October 5, 2020 15:10
mongodb connection and CRUD singleton
/*
*
* 2020 Carlos Martínez
* follow me https://github.com/carlosEdua
*
*/
const MongoClient = require("mongodb").MongoClient;
const mongoClientOptions = { useNewUrlParser: true, useUnifiedTopology: true };
// mongoDB instance