Skip to content

Instantly share code, notes, and snippets.

Uli Kusterer uliwitness

Block or report user

Report or block uliwitness

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
View combine_async_publisher.swift
class Observer: Subscription {
public func unsubscribe() {
...
}
public func request(_ demand: Subscribers.Demand) {
// We only inform on changes.
print("Demand for \(demand) received.")
}
@uliwitness
uliwitness / retroactiveProtocols.swift
Last active Aug 5, 2019
You can make an existing type conform to a protocol you define later in Swift.
View retroactiveProtocols.swift
class OriginalClass {
var fooProp: Int = 15
func sayHello(_ string: String) {
print("Hello \(string) \(fooProp)")
}
}
protocol MockProtocol {
var fooProp: Int { get }
View pagevariations.rb
module Jekyll
class PageVariationsGenerator < Generator
safe true
def generate(site)
pagesCopy = site.pages.dup
site.config['pagevariations'].each_entry do |variation|
pagesCopy.each_entry do |page|
pageCopy = page.dup
oldPermalink = pageCopy.data['permalink']
View error.log
writertest.swift:18:8: error: cannot invoke 'write' with an argument list of type '(T)'
impl.write(foo)
^
writertest.swift:18:8: note: expected an argument list of type '(T.WriterImplType.ValueType)'
impl.write(foo)
^
@uliwitness
uliwitness / Extract Files into separate Git Repository.sh
Last active Mar 16, 2019
Extract individual files from a Github repository
View Extract Files into separate Git Repository.sh
#!/bin/bash
GIT='/Applications/Xcode.app/Contents/Developer/usr/bin/git'
#$SOURCEREPO=$1
#$DESTREPO=$2
SOURCEREPO=/Users/uli/Programming/FileExplorer/UliKit
DESTREPO=/Users/uli/Programming/FileExplorer/ULIXattrMetadataStore
MYDIR=`dirname "$0"`
@uliwitness
uliwitness / Output.log
Last active Dec 7, 2018
SchedulerTestApp
View Output.log
pendingTasks = [Task<E>{ (0/65) @ 600 <-- F }, Task<F>{ (0/66) @ 500 <-- C }, Task<B>{ (0/62) @ 900 <-- A }, Task<A>{ (0/61) @ 1000 <-- C }, Task<D>{ (0/64) @ 700 <-- A }, Task<C>{ (0/63) @ 800 <-- * }]
Worker 1: --
Worker 2: --
Worker 3: --
currentTasks = [Task<C>{ (0/63) @ 800 <-- * }]
Worker 1: Task<C>{ (1/63) @ 800 <-- * }
Worker 2: --
Worker 3: --
currentTasks = []
Worker 1: Task<C>{ (2/63) @ 800 <-- * }
@uliwitness
uliwitness / gist:c10b3ebfb997a2814a01aacd1228a7e5
Created Aug 28, 2018
This is a valid PNG image file stored in a URL.
View gist:c10b3ebfb997a2814a01aacd1228a7e5
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEYAAABICAYAAABLJIP0AAAMJ2lDQ1BJQ0MgUHJvZmlsZQAASImVlwdUk8kWgOcvqSS0QChSQm+iFOnSawABqYKNkAQSSgwJQcSOLCqwFlQsWNFVEdtaAFlsWLAi2PvDAoqyLupiQ+VNEkBXz3vvvHvO/P+XO3fu3Hsz/5wZANRiOGJxNqoOQI4oTxIbGsCakJzCIj0GCKABbWAHzDhcqdg/JiYSQBl6/1Pe3YTWUK7Zy3393P9fRYPHl3IBQGIgp/Gk3BzIhwDAXbliSR4AhB6oN5ueJ4ZMhFECLQkMELK5nDOU7C7nNCVHKmziYwMhpwJApnE4kgwAVOVxsfK5GdCPajlkBxFPKILcBNmHK+DwIH+GPDInZxpkNWvI1mnf+cn4h8+0YZ8cTsYwK3NRCDlIKBVnc2b8n+X435KTLRuawww2mkASFivPWV63rGkRcqZBPidKi4qGrAn5upCnsJdzl0AWljBo/4ErDYQ1A0wAUBqPExQB2QCyqSg7KnJQ75MuDGFDhrVH44V57HjlWJQnmRY76B8t4EuD44aYI1HMJbcplWUl+A/63Cjgs4d8NhYK4pOUcaJt+cLEKMiqkO9Ls+IiBm1eFAoCo4ZsJLJYeczwP8dAuiQkVmmDmedIh/LCPAVCdtQgR+YJ4sOUY7EpXI4iNl3ImXzphMihOHn8oGBlXlgRX5QwGD9WIc4LiB203ybOjhm0x5r42aFyvSnkVml+3NDY3jy42JT54kCcFxOvjA3XyuSExyhjwG1BJAgEQYAFZLClgWkgEwhbe+p74C9lTwjgAAnIAHxgP6gZGpGk6BHBZxwoBH9C4gPp8LgARS8f5EP9l2Gt8mkP0hW9+YoRWaALcg6IANnwt0wxSjQ8WyJ4CjXCn2bnwlizYZP3/aRjqQ3piMHEIGIYMYRog+vjPrgXHgmffrA54e64x1Bc3+wJXYR2wmPCDUIH4c5UYZHkh8hZYBzogD
@uliwitness
uliwitness / 1 coroutines.cpp
Created Sep 9, 2017
Example of two equivalent programs as an illustration how you can transform coroutines into blocks. Pseudocode
View 1 coroutines.cpp
void main()
{
int foo = rand();
int result1 = await doSomethingAsync(foo);
printf( "Result 1: %d", result1 );
int result2 = await doSomethingAsync(foo + 1);
printf( "Result 2: %d", result2 );
return 0;
}
@uliwitness
uliwitness / smalltalkbooleans.swift
Created Aug 28, 2017
Still fascinating how Smalltalk implements if/then/else. Basically it goes like this (in pseudo-Swift):
View smalltalkbooleans.swift
class BooleanClass {
void ifTrue(_ trueHandler: () -> Void, else falseHandler: () -> Void)
}
class TrueBooleanClass {
void ifTrue(_ trueHandler: () -> Void, else falseHandler: () -> Void) {
trueHandler()
}
}
View 1 cxxabi_shared error
Creating symlinks
/Applications/CMake.app/Contents/bin/cmake -E cmake_symlink_library /Users/uli/Programming/llvm/build/Debug/lib/Debug/libc++abi.1.0.dylib /Users/uli/Programming/llvm/build/Debug/lib/Debug/libc++abi.1.dylib /Users/uli/Programming/llvm/build/Debug/lib/Debug/libc++abi.dylib
CMake Error: cmake_symlink_library: System Error: No such file or directory
CMake Error: cmake_symlink_library: System Error: No such file or directory
You can’t perform that action at this time.