Skip to content

Instantly share code, notes, and snippets.

View jspahrsummers's full-sized avatar

Justin Spahr-Summers jspahrsummers

View GitHub Profile
@jspahrsummers
jspahrsummers / Idera Acquires Travis CI.md
Created September 14, 2021 22:47
Idera Acquires Travis CI

Dear Customer,

I am Randy Jacops, the CEO of Idera, Inc. You likely saw the press announcement last month announcing Idera’s acquisition of Travis CI (hereafter, Travis). Here is a link to the announcement if you have not seen it: Idera, Inc. Acquires Travis CI GmbH for Continuous Integration Capabilities.

I’d like to welcome you to the Idera family and look forward to building on Travis’ history of market leading continuous integration products for software developers and testing professionals. I’m writing this letter to introduce Idera and explain why we are excited to acquire Travis.

Idera delivers B2B software productivity tools that allow technical users to do more with less, faster. The company's brands span three divisions—Database Tools, Developer Tools and Testing Tools—with products used and evangelized by millions of community members and more than 50,000 customers worldwide. Continuous integration accelerates software delivery, improves developer productivity, and enables technical innovation t

@jspahrsummers
jspahrsummers / AsynchronousGenerators.md
Last active February 16, 2024 18:55
Python asynchronous generator semantics and types

How to use asynchronous generators

The documentation 6.2.9.4. "Asynchronous generator-iterator methods" is phrased really ambiguously. To make matters worse, typing.AsyncGenerator is not specified fully correctly.

Here, I attempt to more clearly capture the actual interface contract, based on what I've read and observed. See also PEP 492 -- Coroutines with async and await syntax and PEP 525 -- Asynchronous Generators.

This might be useful to implement lower-level behaviors than you can with async for, like sending values into the generator function.

TSend = TypeVar('TSend', contravariant=True)
@jspahrsummers
jspahrsummers / MultipleDispatch.cpp
Last active August 16, 2024 10:52
Example of using RTTI and template specialization for multiple dispatch in C++
template<typename Left, typename Right>
struct Intersect
{
// This will fail to compile if there's no specialization for Intersect<Right, Left>,
// thereby verifying that we've handled all combinations.
typename Intersect<Right, Left>::Result operator() (const Left &lhs, const Right &rhs) const
{
return Intersect<Right, Left>()(rhs, lhs);
}
};
@jspahrsummers
jspahrsummers / ErrorType.swift
Created August 8, 2016 21:55
An unexpected error has occurred.
do {
try myFunctionWhichOnlyThrowsOneErrorType()
} catch let err as ThatOneErrorType {
handleAppropriately()
} catch let err {
preconditionFailure("Unexpected error: \(err)")
}
@jspahrsummers
jspahrsummers / bad.m
Last active January 20, 2021 11:55
Synchronizing with multiple GCD queues
//
// DON'T do this, or else you risk a deadlock (e.g., by accidentally performing it in a different order somewhere)
//
dispatch_async(firstQueue, ^{
dispatch_sync(secondQueue, ^{
// code requiring both queues
});
});
@jspahrsummers
jspahrsummers / main.m
Created November 24, 2015 16:11
[NSThread isMainThread] is probably not what you want!
#import <Foundation/Foundation.h>
int main (int argc, const char **argv) {
@autoreleasepool {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
dispatch_sync(dispatch_get_main_queue(), ^{
NSLog(@"is main thread? %i", (int)[NSThread isMainThread]);
});
});
@jspahrsummers
jspahrsummers / transcript.md
Last active September 12, 2015 15:14
Excerpt from https://reactivex.slack.com about API design, especially as it relates to RAC

carlossless [09:50] So anyone used RxSwift? I’m wondering what are your thoughts and opinions vs RAC3.

jspahrsummers [10:00] @carlossless: https://github.com/ReactiveCocoa/ReactiveCocoa/blob/07813339d3c44aa02fb1b71777baa4ede0f0f77a/README.md#how-does-reactivecocoa-relate-to-rx

carlossless [10:13] Yeah, I was looking for a more practical point of view but even so. RxSwift has UI bindings, it follows the haskell naming for most transformation and composition functions ​map​, ​filter​ etc. rather than ​select​, ​where​.

carlossless [10:14]

@jspahrsummers
jspahrsummers / iflet.m
Last active August 29, 2015 14:16 — forked from cdzombak/iflet.m
#import <Foundation/Foundation.h>
#define iflet(LHS, RHS) \
for (id obj_ = (RHS); obj_ != nil;) \
for (LHS = (obj_ ?: (RHS)); obj_ != nil; obj_ = nil)
int main(int argc, char *argv[]) {
@autoreleasepool {
NSString *x = nil;
NSString *y = @"y";
@jspahrsummers
jspahrsummers / GHRunLoopWatchdog.h
Created January 28, 2015 20:50
A class for logging excessive blocking on the main thread
/// Observes a run loop to detect any stalling or blocking that occurs.
///
/// This class is thread-safe.
@interface GHRunLoopWatchdog : NSObject
/// Initializes the receiver to watch the specified run loop, using a default
/// stalling threshold.
- (id)initWithRunLoop:(CFRunLoopRef)runLoop;
/// Initializes the receiver to detect when the specified run loop blocks for
@jspahrsummers
jspahrsummers / errors.txt
Last active August 29, 2015 14:13
swiftc error “Global is external, but doesn't have external or weak linkage!”
CompileSwift normal x86_64 /Users/justin/GitHub/Mac/Carthage.checkout/ReactiveCocoa/ReactiveCocoa/Swift/Property.swift
cd /Users/justin/GitHub/Mac/Carthage.checkout/ReactiveCocoa
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/justin/GitHub/Mac/Carthage.checkout/ReactiveCocoa/ReactiveCocoa/Swift/Identity.swift /Users/justin/GitHub/Mac/Carthage.checkout/ReactiveCocoa/ReactiveCocoa/Swift/TupleExtensions.swift /Users/justin/GitHub/Mac/Carthage.checkout/ReactiveCocoa/ReactiveCocoa/Swift/OptionalExtensions.swift /Users/justin/GitHub/Mac/Carthage.checkout/ReactiveCocoa/ReactiveCocoa/Swift/Errors.swift /Users/justin/GitHub/Mac/Carthage.checkout/ReactiveCocoa/ReactiveCocoa/Swift/Event.swift /Users/justin/GitHub/Mac/Carthage.checkout/ReactiveCocoa/ReactiveCocoa/Swift/Disposable.swift /Users/justin/GitHub/Mac/Carthage.checkout/ReactiveCocoa/ReactiveCocoa/Swift/FoundationExtensions.swift /Users/justin/GitHub/Mac/Carthage.checkout/ReactiveCocoa/Reac