Skip to content

Instantly share code, notes, and snippets.

Avatar

Joe Maher JoeMaher

  • Console
  • Brisbane, Australia
View GitHub Profile
View Storage.swift
import Foundation
import RAPCore
struct Storage {
static let saveDir: URL = FileManager.default.homeDirectoryForCurrentUser.appendingPathComponent("jsondb")
static func verify() {
let audioFiles = try! FileManager.default.contentsOfDirectory(at: URL(fileURLWithPath: "/dir/to/cafs"), includingPropertiesForKeys: nil, options: FileManager.DirectoryEnumerationOptions.skipsHiddenFiles)
.filter { $0.pathExtension == "caf" }
@JoeMaher
JoeMaher / TriangleView.kt
Created Jun 29, 2017
Android Canvas - drawing an equilateral triangle
View TriangleView.kt
class TriangleView(context: Context?, attrs: AttributeSet?) : View(context, attrs) {
val paint = Paint()
val path = Path()
override fun onDraw(canvas: Canvas?) {
super.onDraw(canvas)
canvas ?: return
canvas.drawPath(configurePath(canvas.width.toFloat(), path), configurePaint(paint))
}