Skip to content

Instantly share code, notes, and snippets.

François Lamboley Frizlab

  • Frost Land
  • Paris, France
Block or report user

Report or block Frizlab

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
DougGregor / dynamic_member_lookup_environment.swift
Created May 2, 2018
Using Swift 4.2's @dynamicMemberLookup to expose environment variables
View dynamic_member_lookup_environment.swift
import Darwin
struct Environment {
subscript(dynamicMember name: String) -> String? {
get {
guard let value = getenv(name) else { return nil }
return String(validatingUTF8: value)
lattner /
Last active Jul 17, 2019 — forked from oleganza/
Concrete proposal for async semantics in Swift

Async/Await for Swift


Modern Cocoa development involves a lot of asynchronous programming using closures and completion handlers, but these APIs are hard to use. This gets particularly problematic when many asynchronous operations are used, error handling is required, or control flow between asynchronous calls gets complicated. This proposal describes a language extension to make this a lot more natural and less error prone.

This paper introduces a first class Coroutine model to Swift. Functions can opt into to being async, allowing the programmer to compose complex logic involving asynchronous operations, leaving the compiler in charge of producing the necessary closures and state machines to implement that logic.

hollance / neural.c
Last active Apr 27, 2018
Playing with BNNS on macOS 10.12. The "hello world" of neural networks.
View neural.c
The "hello world" of neural networks: a simple 3-layer feed-forward
network that implements an XOR logic gate.
The first layer is the input layer. It has two neurons a and b, which
are the two inputs to the XOR gate.
The middle layer is the hidden layer. This has two neurons h1, h2 that
will learn what it means to be an XOR gate.
jakubpetrik / handle-signal.swift
Created Sep 23, 2015
Signal handling in Swift
View handle-signal.swift
Most general purpose operating systems provide interrupt facilities, sometimes called signals.
Unhandled signals generally terminate a program in a disorderly manner. Signal handlers are
created so that the program behaves in a well-defined manner upon receipt of a signal.
For this task you will provide a program that displays a single integer on each line of output at
the rate of one integer in each half second. Upon receipt of the SigInt signal (often created by the user typing ctrl-C)
the program will cease printing integers to its output, print the number of seconds the program has run,
JadenGeller / AnySet.swift
Created Mar 30, 2015
Swift Set of "Any" Type
View AnySet.swift
// Examples
var set = AnySet()
set.contains(6) // -> false
set.contains(3) // -> true
natecook1000 / NSScanner+Swift.swift
Created Mar 3, 2015
Swift-friendly NSScanner methods
View NSScanner+Swift.swift
// NSScanner+Swift.swift
// A set of Swift-idiomatic methods for NSScanner
// (c) 2015 Nate Cook, licensed under the MIT license
import Foundation
extension NSScanner {
// MARK: Strings
seanlilmateus / channel.swift
Last active Nov 22, 2017
swift Go like channels
View channel.swift
import Foundation
// Playground - noun: a place where people can play
class Channel<T> {
var stream: Array<T>
let queue: dispatch_queue_t
let semaphore: dispatch_semaphore_t
init() { = []
jverkoey / NSManagedObjectContext+DebugSwizzling.m
Created Apr 14, 2014
Core Data Managed Object Context Debugging
View NSManagedObjectContext+DebugSwizzling.m
// NSManagedObjectContext+DebugSwizzling.h
#import <CoreData/CoreData.h>
* Toggles debugging of Core Data managed object contexts.
* When enabled, will fire NSLogs in the following cases:
rickharrison / UIViewController.m
Created Aug 16, 2013
iOS 7 Messages Gradient Experimentation
View UIViewController.m
// NRTRootViewController.m
// GradientTableView
// Created by Rick Harrison on 8/15/13.
// Copyright (c) 2013 Rick Harrison. All rights reserved.
#import "NRTRootViewController.h"
jamiew /
Created Mar 7, 2013
Adding subtitles and audio tracks to an MP4 video with MP4Box
# Add subtitle track
MP4Box -add"sbtl:tx3g" Minecraft2_mobile.mp4
# Add audio track
# 1. doesnt work in quicktime/itunes
MP4Box -add commentary_audio.aac Minecraft2_mobile.mp4
# 2. supposed to work in quicktime/itunes but doesn't seem to; :name at least is definitely not supported
MP4Box -add commentary_audio.aac:disable:group1:lang=en:name="Director's Commentary" Minecraft2_mobile.mp4
You can’t perform that action at this time.