Skip to content

Instantly share code, notes, and snippets.

View t-unit's full-sized avatar

Tobias Ottenweller t-unit

View GitHub Profile
@t-unit
t-unit / liblastfm
Created June 16, 2012 15:34
building liblastfm fails (brew output)
$ brew install -v liblastfm
==> Downloading https://github.com/mxcl/liblastfm/tarball/0.3.3
Already downloaded: /Library/Caches/Homebrew/liblastfm-0.3.3.tgz
/usr/bin/tar xf /Library/Caches/Homebrew/liblastfm-0.3.3.tgz
==> ./configure --release --prefix /usr/local/Cellar/liblastfm/0.3.3
./configure --release --prefix /usr/local/Cellar/liblastfm/0.3.3
==> Configuring liblastfm-0.3.3...
Using /usr/local/bin/qmake
==> Determining installation prefix
Will install to: /usr/local/Cellar/liblastfm/0.3.3
@t-unit
t-unit / building liblastfm fails (info)
Created June 16, 2012 15:39
building liblastfm fails (info)
$ brew doctor
Your system is raring to brew.
$ brew --config
HOMEBREW_VERSION: 0.9
HEAD: dc7b6207549f1d87a2188177d8a957deab11fce9
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
@t-unit
t-unit / gist:3387767
Created August 18, 2012 15:33
kAudioUnitSubType_NBandEQ
//
// TOBandEqualizer.h
// EqualizerTest
//
// Created by Tobias Ottenweller on 17.08.12.
// Copyright (c) 2012 Tobias Ottenweller. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <AudioToolbox/AudioToolbox.h>
// AppState.swift
struct AppState: StateType {
var places: PlacesSearchResult?
}
// AppReducer.swift
func appReducer(action: Action, state: AppState?) -> AppState {
return AppState(places: nil)
}
struct FetchPlacesAction: Action { }
class ViewController: UIViewController {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
appStore.dispatch(FetchPlacesAction())
}
}
func fetchPlaces(state: AppState, store: AppStore) -> Action? {
let service = PlacesService([…])
let fakeCoordinates = […]
let radius = […]
service.search(coordinates: fakeCoordinates, radius: radius) { result in
guard let places = result.value else {
return
}
public typealias DispatchFunction = (Action) -> Void
public typealias Middleware<State> = (@escaping DispatchFunction, @escaping () -> State?)
-> (@escaping DispatchFunction) -> DispatchFunction
let logMiddleware: Middleware<StateType> = { dispatch, getState in
return { next in
return { action in
print(action)
next(action)
}
}
}
func logMiddleware(action: Action, context: MiddlewareContext<AppState>) -> Action? {
print(action)
return action
}
let actualMiddleware = createMiddleware(logMiddleware)
enum PlacesAction: Action {
case fetch
case set(PlacesSearchResult)
}