Skip to content

Instantly share code, notes, and snippets.

View santiagoaloi's full-sized avatar
:octocat:
Fall in Love with the Problem, Not the Solution.

Santiago A. santiagoaloi

:octocat:
Fall in Love with the Problem, Not the Solution.
View GitHub Profile
@santiagoaloi
santiagoaloi / nuxt.config.ts
Created March 16, 2024 00:35
nuxt.config.ts
import { fileURLToPath } from 'node:url'
import { config } from 'dotenv'
const nodeEnviroment = process.env.NODE_ENV // 'development' or 'production'
const productionOnly = nodeEnviroment === 'production'
// Load all environment variables from .env files
// config({ path: `.env.production` })
config({ path: `.env.${nodeEnviroment}` })
@santiagoaloi
santiagoaloi / .eslintrc.cjs
Last active January 11, 2024 20:37
.eslintrc.cjs
/* eslint-env node */
// require('@rushstack/eslint-patch/modern-module-resolution')
module.exports = {
root: true,
extends: [
'./.eslintrc-auto-import.json',
'plugin:vue/vue3-strongly-recommended',
'plugin:vuetify/base',
'eslint:recommended',
<template>
<div>
<SettingsCard :loading="loading">
<VRow>
<VCol>
<FormSubtitle subtitle="Avatar" />
<div class="text-body-2"> This is your avatar. </div>
<div class="text-body-2">
Click on the avatar to upload a custom one from your files.</div
>
/**
* Custom Vue 3 composition function for handling image uploads.
*
* @returns {{
* selectedFile: Ref<null | File>,
* base64: Ref<null | string>,
* handleFileChange: (event: Event) => void,
* displayImage: ComputedRef<null | string>
* }}
*/
export function useShake() {
const shake = refAutoReset('', 1000)
function startShaking() {
shake.value = true
}
const isShaking = computed(() => {
return shake.value && 'shake'
})
@santiagoaloi
santiagoaloi / shake-directive.js
Created November 17, 2023 22:51
shake directive
// src/directives/shakeDirective.js
export const shakeDirective = {
install(app) {
// Create the styles dynamically
const styleTag = document.createElement('style')
styleTag.innerHTML = `
.shake {
animation: shake 1s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
transform: translate3d(0, 0, 0);
@santiagoaloi
santiagoaloi / SearchComponent.vue
Created July 12, 2023 22:49
Google Places - Vuetify Autocomplete SFC Concept + Composable
<template>
<div class="text-center">
<VCardText>
<WelcomeTitleSubtitle subtitle="Where would you prefer to work?" title="Geographics" />
</VCardText>
<VRow>
<VCol cols="12">
<div class="mx-[1px]">
<VAutocomplete
{
"name": "vue-sienna",
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "vite --open",
"build": "vite build",
"build:preview": "vite build && vite preview --open",
"preview": "vite preview"
},
@santiagoaloi
santiagoaloi / firestore_add_field_to_all_docs_in_collection.js
Created April 24, 2022 19:54 — forked from gregfenton/firestore_add_field_to_all_docs_in_collection.js
FIRESTORE: a node/JavaScript command-line script that visits all docs in a Firestore collection and updates them with the given values (in this example, we set/add an "enabled" field to TRUE) -- uses the Firebase Web SDK v9 API
/**
* firestore_add_field_to_all_docs_in_collection.js
*
* This script is assumed to live in an existing Javascript project that has its own package.json.
* I store this script in <PROJECT_ROOT>/tools/cleanup/.
*
* To use:
* 1. Import the 'firebase' and 'esm' NPM modules to your project (Run the command: `npm install firebase esm`)
* 2. Edit the data for USER1 and FIREBASE_CONFIG, then adjust parameters in `main` for the call to `visitDocs`.
*
@santiagoaloi
santiagoaloi / Authentication.js
Created April 23, 2022 12:15
Firebase Auth Functions VueJS / VueX / Pathify
// Utilities
import { make } from 'vuex-pathify';
import { isEmpty, capitalize, startCase } from 'lodash';
import { doc, setDoc, updateDoc, serverTimestamp } from 'firebase/firestore';
import {
EmailAuthProvider,
reauthenticateWithCredential,
signInWithEmailAndPassword,
createUserWithEmailAndPassword,
signOut,