Skip to content

Instantly share code, notes, and snippets.

View standinga's full-sized avatar

standinga

View GitHub Profile
test: async function() {
const user = this.$firebase.auth().currentUser
const idToken = await user.getIdToken(true)
const url = `https://sign-9aee2.firebaseio.com/test.json?auth=${idToken}`
const test = await this.$axios.$get(url)
console.log(test)
}
@standinga
standinga / index.vue
Created November 20, 2019 04:33
final update to index.vue for medium post about authenticating with google sign in and firebase
<template>
<div class="container">
<button @click="signInRedirect">Sign With Redirect</button>
<button @click="signInPopup">Sign With Pop Up</button>
<button @click="test">Test</button>
</div>
</template>
<script>
@standinga
standinga / PlayerView.swift
Created December 16, 2019 19:36
MTKView sometimes crashes when drawing CVImageBuffer
import AppKit
import AVFoundation
import MetalKit
class PlayerView: MTKView {
private var ciImage: CIImage? {
didSet {
renderImage()
}
@standinga
standinga / CVPixelBuffer+CMSampleBuffer+Copy.swift
Created December 31, 2019 04:38
Deep Copying of CMSampleBuffer and CVPixelBuffer
//
// CVPixelBuffer+CMSampleBuffer+Copy.swift
// VideoDelaySwift
//
// Created by michal on 16/07/2019.
// Copyright © 2019 michal. All rights reserved.
//
import AVFoundation
import UIKit
import PlaygroundSupport
class MyViewController : UIViewController {
override func loadView() {
let view = UIView()
view.backgroundColor = .white
let label = UILabel()
label.frame = CGRect(x: 150, y: 200, width: 200, height: 20)
const express = require('express')
const app = express()
const port = 3000
const recursive = function (req, res) {
counter ++
setTimeout(recursive, 300);
}
recursive()
import Foundation
URLCache.shared.removeAllCachedResponses() // start each "experiment" with empty cache
let timer = Timer(timeInterval: 1, repeats: true) { _ in
fetch(title: "useProtocolCachePolicy", policy: .useProtocolCachePolicy)
fetch(title: "returnCacheDataElseLoad", policy: .returnCacheDataElseLoad)
fetch(title: "reloadIgnoringLocalCacheData", policy: .reloadIgnoringLocalCacheData)
// fetch(title: "returnCacheDataDontLoad", policy: .returnCacheDataDontLoad)
}
const express = require('express')
const app = express()
const port = 3000
const increment = function () {
counter ++
setTimeout(increment, 1000);
}
var maxAge = 4
func combineAsyncCalls(completionHandler: @escaping (String)->()) {
var text = ""
let semaphore = DispatchSemaphore(value: 0)
DispatchQueue.global().async {
fetchData(0, delay: 0.4) {
text += $0
semaphore.signal()
}
fetchData(1, delay: 0.2) {
text += $0
@standinga
standinga / Server.swift
Last active November 30, 2020 06:57
IOS/OSX Networking initial server
//
// Server.swift
// MultiConnect
//
// Created by michal on 29/11/2020.
//
import Foundation
import Network
import UIKit