- Proposal: SE-NNNN
- Authors: Robert Widmann, Jaden Geller
- Review Manager: TBD
- Status: Awaiting review
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
// Just before switching jobs: | |
// Add one of these. | |
// Preferably into the same commit where you do a large merge. | |
// | |
// This started as a tweet with a joke of "C++ pro-tip: #define private public", | |
// and then it quickly escalated into more and more evil suggestions. | |
// I've tried to capture interesting suggestions here. | |
// | |
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_, | |
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant, |
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
#! /usr/bin/swift | |
import ScriptingBridge | |
@objc protocol iTunesTrack { | |
optional var name: String {get} | |
optional var album: String {get} | |
} | |
@objc protocol iTunesApplication { |
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
/*<?php | |
//*/public class PhpJava { public static void main(String[] args) { System.out.printf("/*%s", | |
//\u000A\u002F\u002A | |
class PhpJava { | |
static function main() { | |
echo(//\u000A\u002A\u002F | |
"Hello World!"); | |
}} | |
//\u000A\u002F\u002A | |
PhpJava::main(); |
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
private class MyArrayBuffer<Element>: ManagedBuffer<Int,Element> { | |
func clone() -> MyArrayBuffer<Element> { | |
return self.withUnsafeMutablePointerToElements { elements -> MyArrayBuffer<Element> in | |
return MyArrayBuffer<Element>.create(self.allocatedElementCount) { newBuf in | |
newBuf.withUnsafeMutablePointerToElements { newElems->Void in | |
newElems.initializeFrom(elements, count: self.value) | |
} | |
return self.value |
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
// Playground - noun: a place where people can play | |
public func id<A>(x : A) -> A { | |
return x | |
} | |
public func error<A>(x : String) -> A { | |
assert(false, x) | |
} |
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
public func unsafeCoerce<A, B>(_ x : A) -> B { | |
return unsafeBitCast(x, to: B.self) | |
} | |
func Y<A>(_ f : @escaping (A) -> A) -> A { | |
return { (x : @escaping (A) -> A) in | |
return f((x(unsafeCoerce(x)))) | |
}({ (x : A) -> A in | |
let fn : (A) -> A = unsafeCoerce(x) | |
return f(fn(x)) |
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
// Playground - noun: a place where people can play | |
protocol ℕ { | |
static func construct() -> Self | |
static var value : UInt { get } | |
} | |
struct Zero : ℕ { | |
static func construct() -> Zero { | |
return Zero() |
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
// | |
// CollectionViewDataSource.swift | |
// Khan Academy | |
// | |
// Created by Andy Matuschak on 10/14/14. | |
// Copyright (c) 2014 Khan Academy. All rights reserved. | |
// | |
import UIKit |
NewerOlder