Skip to content

Instantly share code, notes, and snippets.

@wilsoncusack
wilsoncusack / commune_take_1.sol
Last active October 17, 2020 18:06
A Smart Contract that facilitates creating communes where all funds sent to the commune are distributed amongst members
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
contract Commune is ERC20 {
using SafeMath for uint256;
constructor() public ERC20("Commune DAI", "COMD") {
}
@wilsoncusack
wilsoncusack / ReusableExample.swift
Last active June 30, 2023 23:24
SwiftUI Reusable View Using Generic Types
struct HorizontalList<Item, Card, Detail>: View where Item: NSManagedObject, Card: View, Detail: View{
var items: FetchedResults<Item>
var card: (Item) -> Card
var detail: (Item) -> Detail
// init(items: FetchedResults<Item>, @ViewBuilder card: @escaping (Item) -> Card, @ViewBuilder detail: @escaping (Item) -> Detail) {
// self.items = items
// self.card = card
// self.detail = detail
// }
@wilsoncusack
wilsoncusack / TextViewExperiment.swift
Created July 8, 2019 21:02
SwiftUI + UITextView with dismiss keyboard button
//
// TextViewExperiment.swift
// Wilson Cusack
//
// Most of the code from https://www.icalvin.dev/post/403
// There's a few changes, but mainly just the ability to close the keyboard.
//
import SwiftUI
import UIKit