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
//
// 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
//
// 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.
//
// 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
//
// 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
//
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
//
// url-extensions.swift
//
// Created by Guillaume Lessard
// Copyright (c) 2018 Guillaume Lessard. All rights reserved.
//
// https://gist.github.com/glessard/a2b2916aa74f082a58d50a674174f1a4
//
import Foundation

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:

Expand usability of withMemoryRebound

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

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

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