Instantly share code, notes, and snippets.

View sendTasks.scpt
# Copyright 2017 Travis Kirton
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE US
View Image+ColorAt.swift
public extension Image {
public func color(at point: Point) -> Color {
let bitmapInfo = CGBitmapInfo(rawValue: CGImageAlphaInfo.premultipliedFirst.rawValue)
guard let offscreenContext = CGContext(data: nil, width: 1, height: 1, bitsPerComponent: 8, bytesPerRow: 0, space: CGColorSpaceCreateDeviceRGB(), bitmapInfo: bitmapInfo.rawValue) else {
print("Could not create offscreenContext")
return clear
}
offscreenContext.translateBy(x: CGFloat(-point.x), y: CGFloat(-point.y))
View WorkSpace.swift
//
// WorkSpace.swift
// BeesBombs
//
// Created by travis on 2016-08-27.
// Copyright © 2016 C4. All rights reserved.
//
import UIKit
View WorkSpace.swift
class WorkSpace: CanvasController {
var circles = [Circle]()
var wedges = [Wedge]()
override func setup() {
let d = 160.0 //radius of circle
canvas.backgroundColor = white
let container = View(frame: Rect(0,0,d,d))
container.center = canvas.center
View C4.dvtcolortheme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DVTConsoleDebuggerInputTextColor</key>
<string>0 0 0 1</string>
<key>DVTConsoleDebuggerInputTextFont</key>
<string>Menlo-Bold - 11.0</string>
<key>DVTConsoleDebuggerOutputTextColor</key>
<string>0 0 0 1</string>
View WorkSpace.swift
class WorkSpace: CanvasController {
var player: AudioPlayer!
var timer: Timer?
//create tuples for storing paths
var maxPaths = (Path(), Path())
var avgPaths = (Path(), Path())
//create tuples for storing shapes to represent the paths
var maxShapes = (Shape(), Shape())
var avgShapes = (Shape(), Shape())
View WorkSpace.swift
class WorkSpace: CanvasController {
var max0 = 0.0
var max1 = 0.0
var avg0 = 0.0
var avg1 = 0.0
var player = AudioPlayer("BlackVelvet.m4a")!
var timer: Timer?
View MathComparePaths.swift
// Copyright © 2016 C4
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions: The above copyright
// notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
View WorkSpace.swift
// import C4
import UIKit
class WorkSpace: CanvasController {
var screenRecorder: ScreenRecorder?
override func setup() {
self.screenRecorder = ScreenRecorder()
self.screenRecorder?.recordingEndedAction = {
self.screenRecorder?.showPreviewInController(self)
}
View WorkSpace.swift
// Copyright © 2014 C4
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions: The above copyright
// notice and this permission notice shall be included in all copies or
// substantial portions of the Software.