Skip to content

Instantly share code, notes, and snippets.

@z5h
z5h / Example.elm
Last active November 23, 2020 13:10
Elm focusout focusin
import Browser.Dom
import Element exposing (Element)
import Element.Background as Background
import Element.Border as Border
import Element.Font as Font
import Element.Input as Input
import Html
import Html.Attributes
import Html.Events
import Json.Decode as Decode
@ccabanero
ccabanero / Sample iOS Unit Tests: Working with a ViewController composed of CollectionViews
Last active August 16, 2022 03:07
Sample iOS Unit Tests: Working with a ViewController composed of CollectionViews
class ViewControllerTest: XCTestCase {
var systemUnderTest: ViewController!
override func setUp() {
super.setUp()
//get the storyboard the ViewController under test is inside
let storyboard: UIStoryboard = UIStoryboard(name: "Main_iPhone", bundle: nil)
@adunsmoor
adunsmoor / gist:e848356a57980ab9f822
Last active December 17, 2018 08:45
closed convex hull in Swift
import UIKit
// Returns a list of points on the convex hull in counter-clockwise order.
// Note: the last point in the returned list is the same as the first one.
//
// https://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain
//
func closedConvexHull(points_ : [CGPoint]) -> [CGPoint] {
// 2D cross product of OA and OB vectors, i.e. z-component of their 3D cross product.