This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SpriteKit | |
func CGPolygonPath(radius: CGFloat, vertices: CGFloat) -> CGPath { | |
let path = CGMutablePath() | |
let angle = 360.0 / vertices | |
var i = CGFloat(1.0); while i <= vertices { | |
let degrees = angle * i + 90.0 | |
let radians = degrees * .pi / 180.0 | |
let point = CGPoint( | |
x: cos(radians) * radius, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct ContentView: View { | |
@ObservedObject var browser = { () -> DocumentBrowserObject in | |
let dbo = DocumentBrowserObject ( | |
forOpeningFilesWithContentTypes: [ | |
"public.png", | |
"public.jpeg" | |
] | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
import SafariServices | |
struct DemoView: View, Hostable { | |
@EnvironmentObject var hostedObject: HostingObject<DemoView> | |
var address: String = "https://example.com" | |
func present() { // UIKit code | |
let safari = SFSafariViewController(url: URL(string: address)!) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
public struct Polygon: Shape { | |
public let sides: Int | |
public init(sides: Int) { self.sides = sides } | |
public func path(in rect: CGRect) -> Path { | |
let diameter = Double(min(rect.size.width, rect.size.height)) | |
let radius = diameter / 2.0 | |
let rad = Double.pi / 180.0 | |
let center = CGPoint(x: rect.size.width / 2.0, y: rect.size.height / 2.0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SpriteKit | |
import PlaygroundSupport | |
class Scene: SKScene { | |
var hands: [String: SKShapeNode] = [:] | |
override func didMove(to view: SKView) { | |
let center = CGPoint(x: frame.midX, y: frame.midY) | |
let radius = CGFloat(450) | |
let face = SKShapeNode(circleOfRadius: radius) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
"background-color:red;font-size:32px;" | |
{backgroundColor:"red",fontSize:"32px"} | |
[{backgroundColor:"red"},{fontSize:"32px"}] | |
[["background-color","red"],["font-size","32px"]] | |
*/ | |
const kebab_case = s => s.replace(/[A-Z]/g,"-$&").toLowerCase(); | |
const camel_case = s => s.replace(/(\-)([a-z])/g,(...a)=>a[2].toUpperCase()); | |
const assign = (a,b) => Object.assign(a,b); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
"background-color:red;font-size:32px;" | |
{backgroundColor:"red",fontSize:"32px"} | |
[{backgroundColor:"red"},{fontSize:"32px"}] | |
*/ | |
const kebab_case = s => s.replace(/[A-Z]/g,"-$&").toLowerCase(); | |
const camel_case = s => s.replace(/(\-)([a-z])/g,(...a)=>a[2].toUpperCase()); | |
const CASCADE = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=2"> | |
<meta name="apple-mobile-web-app-capable" content="yes"> | |
<style>body{margin:0;padding:0;}</style> | |
<script type="module"> | |
document.addEventListener('touchmove',e=>e.preventDefault(),{passive:false}) | |
import { h, app } from 'https://unpkg.com/hyperapp?module' | |
!function() { |
NewerOlder