Skip to content

Instantly share code, notes, and snippets.

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

1amageek 1amageek

🎈
🥺🥺🥺🥺🥺🥺🥺🥺🥺🥺🥺
View GitHub Profile
@1amageek
1amageek / gist:66fe81a6abe3a594861b
Last active January 3, 2016 14:27
CoreBluetooth swift bug
#import "ViewController.h"
@import CoreBluetooth;
@interface ViewController () <CBPeripheralManagerDelegate>
@property (nonatomic) CBPeripheralManager *peripheralManager;
@end
@implementation ViewController
@1amageek
1amageek / file0.swift
Last active May 16, 2017 01:22
Firebase Cloud Functionsを使ってFacebook AccountKitをFirebase Authと連携する ref: http://qiita.com/1amageek/items/c7adbd9f2bbf3a57d352
// AccoutKitの初期化
let accountKit: AKFAccountKit = AKFAccountKit(responseType: .authorizationCode)
// AccountKitを起動して電話番号認証を行う
func login() {
let inputStatus: String = UUID().uuidString
let viewController: AKFViewController = self.accountKit.viewControllerForPhoneLogin(with: nil, state: inputStatus) as! AKFViewController
prepareLoginViewController(viewController: viewController)
self.present(viewController as! UIViewController, animated: true, completion: nil)
@1amageek
1amageek / package-lock.json
Last active April 26, 2019 03:06
14 UNAVAILABLE: Getting metadata from plugin failed with error: fetch is not a function
{
"name": "functions",
"requires": true,
"lockfileVersion": 1,
"dependencies": {
"@babel/code-frame": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz",
"integrity": "sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA==",
"dev": true,
@1amageek
1amageek / ContentView.swift
Created September 23, 2019 01:04
SwiftUI ModalView sample
import SwiftUI
enum ModalViewState: Equatable {
case closed
case original
case custom(height: CGFloat)
case dragging(height: CGFloat?, location: CGPoint, translation: CGSize)
}
@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 = ""
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();
}
}
//
// ProductsViewController.swift
// Created by nori on 2020/03/15.
// Copyright © 2020 nori. All rights reserved.
//
import UIKit
import Instantiate
import Firebase
import Ballcap
@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
@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');
type DateTime = Date
type Url = string
namespace OpenGraph {
// Object Types
type WebsiteType = "website"
type ArticleType = "article"