Skip to content

Instantly share code, notes, and snippets.

View glessard's full-sized avatar

Guillaume Lessard glessard

  • California, USA
View GitHub Profile
@glessard
glessard / DeferredTaskList.swift
Last active August 29, 2015 14:05
A defer keyword in Swift
View DeferredTaskList.swift
//
// defer.swift
// DeferredTaskList
//
private class DeferredTasks
{
private typealias Task = () -> ()
var list = [Task]()
@glessard
glessard / shuffle.swift
Last active June 29, 2018 02:48
Shuffle a CollectionType
View shuffle.swift
//
// shuffle.swift
//
// Created by Guillaume Lessard on 2014-08-28.
// Copyright (c) 2016 Guillaume Lessard. All rights reserved.
//
// https://github.com/glessard/shuffle
// https://gist.github.com/glessard/7140fe885af3eb874e11
//
@glessard
glessard / future.swift
Last active August 29, 2015 14:16
Asynchronous future result in Swift. No new type.
View future.swift
//
// future.swift
//
// Created by Guillaume Lessard on 2014-11-14.
// Copyright (c) 2014 Guillaume Lessard. All rights reserved.
//
// https://gist.github.com/glessard/2abbfd76d401b1b833cc
//
import Dispatch
@glessard
glessard / syncprint.swift
Last active August 31, 2016 05:37
print, synchronized for multiple threads
View syncprint.swift
//
// syncprint.swift
//
// Created by Guillaume Lessard on 2014-08-22.
// Copyright (c) 2016 Guillaume Lessard. All rights reserved.
//
// https://github.com/glessard/syncprint
// https://gist.github.com/glessard/826241431dcea3655d1e
//
View result-struct.swift
public struct Result<Value>
{
private let state: State<Value>
init(_ value: Value) {
state = .value(value)
}
init(_ error: Error) {
state = .error(error)
@glessard
glessard / url-extensions.swift
Created March 8, 2018 23:14
Extensions that help reduce pain when building up Foundation.URL instances
View url-extensions.swift
//
// url-extensions.swift
//
// Created by Guillaume Lessard
// Copyright (c) 2018 Guillaume Lessard. All rights reserved.
//
// https://gist.github.com/glessard/a2b2916aa74f082a58d50a674174f1a4
//
import Foundation
View keybase.md

Keybase proof

I hereby claim:

  • I am glessard on github.
  • I am glessard (https://keybase.io/glessard) on keybase.
  • I have a public key ASBg9FfGSW_7QAPJ-Sd1KFxbrIzz4KVj4PgcwmlUTGkR5wo

To claim this, I am signing this object:

View NNNN-withMemoryRebound.md

Expand usability of withMemoryRebound

@glessard
glessard / NNNN-UP-and-URP-improvements.md
Last active October 23, 2021 17:03
NNNN Pointer API usability improvements
View NNNN-UP-and-URP-improvements.md

Pointer API Usability Improvements

  • Proposal: [SE-NNNN full proposal draft][proposal]
  • Authors: Guillaume Lessard, Andrew Trick
  • Review Manager: TBD
  • Status: [Draft pull request][draft-pr]
  • Implementation: pending
  • Bugs: rdar://64342031, SR-11156 (rdar://53272880), rdar://22541346
  • Previous Revision: none
@glessard
glessard / se-buffer-pointer-initialization.md
Last active December 6, 2021 20:53
Improvements to BufferPointer and Pointer initialization methods
View se-buffer-pointer-initialization.md

Initialization improvements for UnsafePointer and UnsafeBufferPointer family

  • Proposal: [SE-NNNN Initialization improvements for UnsafePointer and UnsafeBufferPointer family][proposal]
  • Author: Guillaume Lessard
  • Review Manager: TBD
  • Status: [Draft Pull Request][draft-pr]
  • Implementation: pending
  • Bugs: rdar://51817146, https://bugs.swift.org/browse/SR-14982 (rdar://81168547), rdar://74655413
  • Previous Revision: none