Skip to content

Instantly share code, notes, and snippets.

View JamieCurnow's full-sized avatar

Jamie Curnow JamieCurnow

  • HiYield
  • Cornwall, Uk
View GitHub Profile
@JamieCurnow
JamieCurnow / firestore.ts
Last active April 14, 2024 01:42
Using Firestore with Typescript
/**
* This Gist is part of a medium article - read here:
* https://jamiecurnow.medium.com/using-firestore-with-typescript-65bd2a602945
*/
// import firstore (obviously)
import { firestore } from "firebase-admin"
// Import or define your types
// import { YourType } from '~/@types'
@JamieCurnow
JamieCurnow / firestore.ts
Created December 8, 2020 13:33
Using Firestore with Typescript - no examples
/**
* This Gist is part of a medium article - read here:
* https://jamiecurnow.medium.com/using-firestore-with-typescript-65bd2a602945
*/
// import firstore (obviously)
import { firestore } from "firebase-admin"
// Import or define your types
// import { YourType } from '~/@types'
@JamieCurnow
JamieCurnow / entry.ts
Last active July 29, 2023 20:58
Using firebase web framework with Nuxt 3
// preset/entry.ts
import '#internal/nitro/virtual/polyfill'
import { toNodeListener } from 'h3'
import { trapUnhandledNodeErrors } from './utils'
const nitroApp = useNitroApp()
export const listener = toNodeListener(nitroApp.h3App)
@JamieCurnow
JamieCurnow / useFirebase.ts
Created April 7, 2022 10:33
Using firebase in a back-end node service
// Get the imports
import { credential } from 'firebase-admin'
import { initializeApp } from 'firebase-admin/app'
import { getFirestore, CollectionReference, DocumentData } from 'firebase-admin/firestore'
// get the service account - IT SHOULD BE GIT IGNORED!
// Make one and download it here:
// https://console.firebase.google.com/u/0/project/your-project-name/settings/serviceaccounts/adminsdk
const serviceAccount = require('../../firebase-admin-service-account.json')
@JamieCurnow
JamieCurnow / firestore.ts
Last active June 28, 2023 23:27
Using Firestore with Typescript - including update helper
/**
* This Gist is part of a medium article - read here:
* https://jamiecurnow.medium.com/using-firestore-with-more-typescript-8058b6a88674
*/
// import firstore (obviously)
import { firestore } from "firebase-admin"
// Here's the helper type for paths:
type PathImpl<T, K extends keyof T> =
@JamieCurnow
JamieCurnow / Header.vue
Created October 28, 2021 12:34
Tailwind vue header with nice transitions
<template>
<div id="header" :class="headerClasses" class="z-40 w-full">
<div class="sticky top-0 inset-0 z-40">
<div class="max-w-7xl mx-auto flex justify-between items-center px-4 py-5 sm:px-6 sm:py-4 lg:px-8 md:justify-start md:space-x-10">
<div class="flex-1 flex flex-row items-center justify-between">
<nav class="flex flex-col sm:flex-row sm:space-x-10">
<a id="whyIsItNeeded" href="#joinTheMovement" v-smooth-scroll class="text-base font-medium">
Why is it needed?
</a>
<a id="faqs" href="#questions" v-smooth-scroll class="text-base font-medium">
build: {
extractCSS: false,
extend (config, {isDev}) {
if (isDev && process.client) {
config.module.rules.push({
enforce: 'pre',
test: /\.(js|vue)$/,
loader: 'eslint-loader',
exclude: /(node_modules)/
})
import Vue from 'nativescript-vue'
import App from './components/App'
// Prints Vue logs when --env.production is *NOT* set while building
Vue.config.silent = (TNS_ENV === 'production')
Vue.registerElement('RadSideDrawer', () => require('nativescript-ui-sidedrawer').RadSideDrawer)
new Vue({
render: h => h('frame', [h(App)])
import Vue from 'nativescript-vue'
import routes from '~/router'
import store from '~/store'
import sideDrawer from '~/components/sideDrawer'
import drawerContent from '~/components/drawerContent'
// Prints Vue logs when --env.production is *NOT* set while building
Vue.config.silent = (TNS_ENV === 'production')
Vue.registerElement('RadSideDrawer', () => require('nativescript-ui-sidedrawer').RadSideDrawer)
// NativeScript core theme
// @see https://docs.nativescript.org/ui/theme
@import '~nativescript-theme-core/scss/light';
// Override variables here
@import '~nativescript-theme-core/scss/index';
// Global SCSS styling
// @see https://docs.nativescript.org/ui/styling