Skip to content

Instantly share code, notes, and snippets.

View 1amageek's full-sized avatar
🎈
🥺🥺🥺🥺🥺🥺🥺🥺🥺🥺🥺

1amageek 1amageek

🎈
🥺🥺🥺🥺🥺🥺🥺🥺🥺🥺🥺
View GitHub Profile
@1amageek
1amageek / MessageView.swift
Last active February 1, 2022 07:42
Message UI Sample Code
//
// ContentView.swift
// Message
//
// Created by 1amageek on 2022/02/01.
//
import SwiftUI
struct Transcript: Identifiable, Codable, Hashable {
@propertyWrapper public struct Supported<Value> {
private var status: Status
private var valueWhenUnsupported: Value
public init(valueWhenUnsupported: Value) {
self.status = Status(isSupported: false, value: valueWhenUnsupported)
self.valueWhenUnsupported = valueWhenUnsupported
}
@1amageek
1amageek / AppDelegate.swift
Created November 4, 2020 08:19
Adding Firebase to AppDelegate in SwiftUI
import SwiftUI
import Firebase
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
FirebaseApp.configure()
return true
}
}
@1amageek
1amageek / FirestoreMonitoring.swift
Created August 19, 2020 09:56
Count Cloud Firestore Reads
//
// FirestoreMonitoring.swift
// Monitor
//
// Created by nori on 2020/08/19.
// Copyright © 2020 1amageek. All rights reserved.
//
import Foundation
import FirebaseFirestore
type DateTime = Date
type Url = string
namespace OpenGraph {
// Object Types
type WebsiteType = "website"
type ArticleType = "article"
@1amageek
1amageek / webpack.config.js
Created May 6, 2020 10:04
webpack.config for ballcap.ts
'use strict';
const fs = require('fs');
const path = require('path');
const webpack = require('webpack');
const resolve = require('resolve');
const PnpWebpackPlugin = require('pnp-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
const InlineChunkHtmlPlugin = require('react-dev-utils/InlineChunkHtmlPlugin');
@1amageek
1amageek / firestore-hook.ts
Last active April 30, 2020 02:32
Cloud Firestore Collection Reference hooks for React
import { useEffect, useState } from 'react'
import firebase, { database } from "firebase"
import "firebase/firestore"
import "firebase/auth"
import { firestore, Doc, DocumentReference } from '@1amageek/ballcap'
export const useDocumentListen = <T extends Doc>(type: typeof Doc, documentReference?: DocumentReference, waiting: boolean = false): [T | undefined, boolean, Error?] => {
interface Prop {
data?: T
loading: boolean
//
// ProductsViewController.swift
// Created by nori on 2020/03/15.
// Copyright © 2020 nori. All rights reserved.
//
import UIKit
import Instantiate
import Firebase
import Ballcap
class Animal<T> {
static identity<T extends new (...args: any[]) => Animal<any>>(this: T) {
return this;
}
static create<T extends Animal<any>>(this: new (...args: any[]) => T) {
return new this();
}
}
@1amageek
1amageek / ContentView.swift
Created November 7, 2019 06:07
SwiftUI Validation
struct Address {
var firstName: String = ""
var lastName: String = ""
var postalCode: String = ""
var state: String = ""