Skip to content

Instantly share code, notes, and snippets.

View joanmolinas's full-sized avatar
🎯
Focusing

Joan Molinas joanmolinas

🎯
Focusing
View GitHub Profile
class ContentController {
func show(_ type: Membership = .free) {
// Do stuff
switch type {
case .free:
// Show free content
case .subscriptor:
// Show subscriptor content
}
class RectangleField {
var width: Float = 0
var height: Float = 0
var area: Float {
return width * height
}
}
protocol Field {
var area: Float { get }
}
class RectangleField: Field {
var width: Float = 0
var height: Float = 0
var area: Float {
return width * height

Hampy

API endpoint

Development: http://localhost:8181/api/v1
Production: http://usehamp.io/api/v1
import Foundation
fileprivate typealias WavByte = UInt8
fileprivate typealias WavInt = UInt32
fileprivate typealias WavShort = UInt16
fileprivate struct WavConstants {
static let RIFF = [WavByte]("RIFF".utf8)
static let WAVE = [WavByte]("WAVE".utf8)
static let fmt = [WavByte]("fmt ".utf8)
@joanmolinas
joanmolinas / Transaccionalidad.swift
Last active July 15, 2021 07:27
Imbee Transaccionalidad
// ============ IOS ============
// 1.
public func messageReceived(message: Message) {
guard !message.isSentByMe() else {return}
var externalType:String?
var externalData: [AnyHashable: Any]?
if let externalMessageContent = message.content as? ExternalContent {
externalType = externalMessageContent.externalType
externalData = externalMessageContent.externalData
}