Skip to content

Instantly share code, notes, and snippets.

View michaelevensen's full-sized avatar

Michael Nino Evensen michaelevensen

View GitHub Profile
import { Data, Override } from "framer";
export const data = Data({
isRecording: false
});
export const toggleRecording: Override = () => {
return {
onTap() {
data.isRecording = (data.isRecording ? false : true);
//Create TapGesture Recognizer
let tap = UITapGestureRecognizer(target: self, action: #selector(handleTap(rec:)))
//Add recognizer to sceneview
sceneView.addGestureRecognizer(tapRec)
//Method called when tap
@objc func handleTap(rec: UITapGestureRecognizer){
if rec.state == .ended {
import React from "react";
import dateFns from "date-fns";
class Calendar extends React.Component {
state = {
currentMonth: new Date(),
selectedDate: new Date()
};
renderHeader() {
@michaelevensen
michaelevensen / FireStoreQuery.swift
Created February 8, 2019 09:18
Default FireStore listener
self.albumQuery()
.order(by: "title", descending: true)
.getDocuments { (querySnapshot, error) in
if let err = error {
debugPrint("Error fetching documents \(err)")
}
else {
guard let documentSnapshot = querySnapshot else { return }
@michaelevensen
michaelevensen / AudioPlayer.swift
Created April 23, 2019 07:03 — forked from netgfx/AudioPlayer.swift
A basic audio player with observers and extra features. Based on AVFoundation and AVQueuePlayer
//
// AudioPlayer.swift
//
// Created by MDobekidis
//
import Foundation
import AVFoundation
import UIKit
import Signals
@michaelevensen
michaelevensen / AVPlayer+Repeat.swift
Created May 10, 2019 19:45 — forked from junpluse/AVPlayer+Repeat.swift
AVQueuePlayer.repeatMode = .All
//
// AVPlayer+Repeat.swift
//
// Created by Jun Tanaka on 4/1/16.
// Copyright © 2016 eje Inc. All rights reserved.
//
import AVFoundation
private final class RepeatManager: NSObject {
@michaelevensen
michaelevensen / RestaurantTableViewDataSource.swift
Created August 20, 2019 08:56
Example #1 DataSource for FireStore.
//
// Copyright (c) 2018 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
@michaelevensen
michaelevensen / LocalCollection.swift
Created August 20, 2019 08:57
LocalCollection to be used together with DataSource for Firestore Queries.
//
// Copyright (c) 2016 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
@michaelevensen
michaelevensen / DataSourceLocalCollection.swift
Created August 20, 2019 09:18
Example #3 of custom DataSource implementation using LocalCollection.
//
// Copyright (c) 2018 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
@michaelevensen
michaelevensen / NewLocalCollection.swift
Created August 21, 2019 11:04
A class for easily unwrapping, storing and mapping FireStore results to models. Inspired by https://gist.github.com/michaelevensen/c74b79292fa8dba437552f7a9f10a5dc.
//
// LocalCollection.swift
// Slow
//
// Created by Michael Nino Evensen on 20/08/2019.
// Copyright © 2019 Michael Nino Evensen. All rights reserved.
//
import FirebaseFirestore