Skip to content

Instantly share code, notes, and snippets.

View availability.md
@erica
erica / 00-dragndrop.swift
Last active Jun 28, 2020
Building an OSX Drag and Drop Playground: Throw the dragndrop.swift into shared Sources and then test out the examples in individual playgrounds. Make sure the assistant is open and set to the timeline. I prefer vertical assistant stacking for this.
View 00-dragndrop.swift
import Cocoa
// Support Foundation calls on String
public extension String { public var ns: NSString {return self as NSString} }
/// Custom Labeled Playground-Based Drag-and-Drop window
public class DropView: NSTextField {
// Default action handler
public var handler: ([String]) -> Void = { paths in Swift.print(paths) }
View c.swift
import UIKit
extension UIBezierPath {
func traverseElements() -> NSArray {
var array: [AnyObject] = []
withUnsafeMutablePointer(&array) {
arrayPtr -> Void in
View forPaul.txt
1d0
< import AppKit
9a9
> import StoreKit
10a11
> import UIKit
25,35c26,28
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
View Separator2.swift
extension String {
/// Returns a new string with the camel-case-based words of this string
/// split by the specified separator.
///
/// Examples:
///
/// "myProperty".convertedToSnakeCase()
/// // my_property
/// "myURLProperty".convertedToSnakeCase()
View 1_Cozmo.py
import sys
from enum import *
import cozmo
from cozmo.util import degrees
from Triggers import *
# Log Error
def error(message):
print("*********************ERROR:", message)
View retag gitconfig
####
# Retag
retag = "!f(){ name=`git tag`; git tag -d \"$name\"; echo "Retagged $name"; remote=`git remote -v`; \
if [ \"$remote\" != \"\" ]; then git push origin --delete \"$name\"; fi; \
git tag \"$name\"; \
if [ \"$remote\" != \"\" ]; then git push --tags; else echo "No remote"; fi; };f"
untag = "!f(){ name=`git tag`; git tag -d \"$name\"; remote=`git remote -v`; \
if [ \"$remote\" != \"\" ]; then git push origin --delete \"$name\"; \
else echo "No remote"; fi; };f"
tagit = "!f(){ git tag \"$@\"; echo "Tagged $name"; remote=`git remote -v`; \
View with.md

Introducing with to the Standard Library

Introduction

This proposal introduces a with function to the standard library. This function

View Swift Cascading.md

Adding Method Cascades

  • Proposal: TBD
  • Author(s): Erica Sadun
  • Status: TBD
  • Review manager: TBD

Introduction

Method cascades offer a method-based counterpart to functional chaining. In functional chaining, partial results pass from one step to the next. In cascades, object scope is maintained through a series of sequential calls. Both approaches support fluent interfaces, providing readable streamlined code.

View CrossPlatformDefines.swift
/*
Erica Sadun, http://ericasadun.com
Cross Platform Defines
Apple Platforms Only
Will update to #if canImport() when available
*/
You can’t perform that action at this time.