Skip to content

Instantly share code, notes, and snippets.

View aprilmintacpineda's full-sized avatar
🦄
Building unicorns.

April Mintac Pineda aprilmintacpineda

🦄
Building unicorns.
View GitHub Profile
@aprilmintacpineda
aprilmintacpineda / country-code-to-currency-code-mapping.csv
Created November 18, 2023 12:06 — forked from HarishChaudhari/country-code-to-currency-code-mapping.csv
Country, Country Code, Currency code mapping in CSV format Taken from https://gist.github.com/304261 Contains 249 countries.
Country CountryCode Currency Code
New Zealand NZ New Zealand Dollars NZD
Cook Islands CK New Zealand Dollars NZD
Niue NU New Zealand Dollars NZD
Pitcairn PN New Zealand Dollars NZD
Tokelau TK New Zealand Dollars NZD
Australian AU Australian Dollars AUD
Christmas Island CX Australian Dollars AUD
Cocos (Keeling) Islands CC Australian Dollars AUD
Heard and Mc Donald Islands HM Australian Dollars AUD
@aprilmintacpineda
aprilmintacpineda / TypeScript: Queueing promises.md
Last active July 20, 2022 11:52
TypeScript: Queueing promises

What's this?

This was my answer to an exam that I went through online today. I think it might also be useful in the future so I'm putting it here as future reference when I need this functionality.

Buffering Promises

In this challenge, you'll be asked to wrap an unknown asynchronous function, returning a new function with a modified asynchronous behavior. The returned function will prevent making too many calls to the asynchronous function at once by buffering extra requests until an earlier one has completed.

A common use case would be to prevent overrunning an API endpoint, so you make no more than 4 requests simultaneously.

Your Task

@aprilmintacpineda
aprilmintacpineda / Linting setup with TypeScript.md
Last active November 11, 2022 07:24
Linting setup with TypeScript

This setup achieves:

  • Imports will be resolved from /src folder.
  • Code formatter and linter that works with the import module resolver.

1. Install dependencies

yarn add prettier eslint @typescript-eslint/typescript-estree @typescript-eslint/eslint-plugin eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-module-resolver eslint-plugin-import  eslint-import-resolver-babel-module babel-plugin-module-resolver husky lint-staged eslint-plugin-jest @typescript-eslint/parser --dev
@aprilmintacpineda
aprilmintacpineda / ReactTS with linting setup.md
Last active February 21, 2023 06:29
ReactTS with linting setup

This setup achieves:

  • Imports will be resolved from /src folder.
  • Code formatter and linter that works with the import module resolver.
  • Setup react-hooks linting

Using TypeScript

1. Install dependencies

@aprilmintacpineda
aprilmintacpineda / Clean all dynamodb tables.md
Last active October 28, 2021 22:53
A script to cleanup (delete all items) your dynamodb tables in appsync

What is this?

THIS SCRIPT WILL DELETE ALL ITEMS OF THE DYNAMODB TABLES OF YOUR APPSYNC APP.

How to use:

  1. Copy-paste the script to your machine.
  2. Run yarn add @aws-sdk/util-dynamodb aws-sd date-fnsk prompt-confirm.
  3. Provide the correct values in the configuration section of the script.
  4. Run the script via nodejs.
@aprilmintacpineda
aprilmintacpineda / Re-index AWS AppSync ElasticSearch.md
Last active October 28, 2021 22:29
Set updatedAt to an updated value for all records in all tables in an AppSync environment

What

When using AWS AppSync with ElasticSearch, sometimes, the data on elastic search gets corrupted or gets missing, what you need to do to get it fixed is to update each items on all the table, which you don't wanna do manually.

This script will update each items on all dynamodb table in your AppSync by setting the updatedAt to the current timestamp.

THIS SCRIPT WILL UPDATE ALL ITEMS OF YOUR DYNAMODB IN YOUR APPSYNC APP

Usage

@aprilmintacpineda
aprilmintacpineda / copy-database.js
Last active June 21, 2023 13:52
This nodejs script allows you to copy a faunadb (its collections, indexes, functions, and data) from a source to a destination. Note that the time it will take for this script to complete is completely dependent on how much data you have on your source database.
/**
* NOTES:
* - For the `domain` in configs, please refer to https://docs.fauna.com/fauna/current/api/fql/region_groups
* - For the `secret`, please make sure that it's `admin`. Refer to https://docs.fauna.com/fauna/current/security/keys?lang=javascript
* - The script retains the `Ref` of the data when it's being copied from the source to the destination, so relationships relying on this should still work out of the box.
* - The goal here is to make an exact replicate of the source, so once the script is done running, the destination should just work out of the box.
* - The script also checks if the collection, index, function or data already exists to prevent duplicates.
*/
/**
@aprilmintacpineda
aprilmintacpineda / ReactJS with linting setup.md
Last active January 13, 2024 21:41
ESLint and Prettier setup for ReactJS

This setup achieves:

  • Imports will be resolved from /src folder.
  • Code formatter and linter that works with the import module resolver.
  • Setup react-hooks linting

1. Install dependencies

yarn add prettier eslint @babel/eslint-parser eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-module-resolver eslint-plugin-import eslint-import-resolver-babel-module babel-plugin-module-resolver husky lint-staged eslint-plugin-jest --dev
@aprilmintacpineda
aprilmintacpineda / .eslintrc.js
Last active December 9, 2020 08:49
Code formatting
module.exports = {
env: {
browser: true,
node: true,
es6: true,
'jest/globals': true
},
root: true,
plugins: ['jest', 'react'],
extends: [
@aprilmintacpineda
aprilmintacpineda / nested-fql-template.js
Created June 18, 2020 05:23 — forked from ptpaterson/nested-fql-manual.js
Template for building deeply nested FQL queries for FaunaDB
const baseQuery = q.Paginate(q.Match(q.Index(indexName), terms));
// or
// const baseQuery = q.Paginate(q.Collection(collectionName))
const expandedQuery = q.Map(baseQuery, (ref) =>
q.Let(
{
instance: q.Get(q.Var('ref'))
},
{