This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Use RequestQueue.request() instead of CF.request() | |
* At any point, to cancel all pending callbacks, call RequestQueue.clear() | |
* | |
*/ | |
var RequestQueue = (function(){ | |
var self = { | |
q: [], | |
next: 0 | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
containerView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() | |
{ | |
public void onGlobalLayout() | |
{ | |
final Activity app = getActivity(); | |
if (app == null) | |
return; | |
Rect r = new Rect(); | |
containerView.getWindowVisibleDisplayFrame(r); | |
boolean visible = (Math.abs(r.height() - containerView.getHeight()) > 128); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)setupDraggableHeaderGestureRecognizer { | |
// setup a gesture recognizer so we can drag the "I need some daytime hours" header up and down | |
@weakify(self); | |
UIPanGestureRecognizer *recognizer = [[UIPanGestureRecognizer alloc] init]; | |
_draggableHeaderView.userInteractionEnabled = YES; | |
[_draggableHeaderView addGestureRecognizer:recognizer]; | |
RACDisposable *disposable = [[[recognizer | |
rac_gestureSignal] | |
scanWithStart:RACTuplePack(@(_mapViewHeightConstraint.constant), @0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* PageFlipMonitor v1.0 | |
* Copyright 2013 CommandFusion, public domain | |
* | |
* Utility object that monitors entering and exiting pages, | |
* and can call any number of callbacks specifically registered to observe | |
* when entering or exiting a page | |
* | |
* You callback functions should be of the form: | |
* | |
function callback(fromPage, toPage) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Results+Rx.swift | |
// | |
// Make Realm auto-updating Results observable. Works with Realm 0.98 and later, RxSwift 2.1.0 and later. | |
// | |
// Created by Florent Pillet on 12/02/16. | |
// Copyright (c) 2016 Florent Pillet. All rights reserved. | |
// | |
import Foundation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Created by Florent Pillet on 14/11/16. | |
// Copyright (c) 2016 Florent Pillet. All rights reserved. | |
// | |
import Foundation | |
/* | |
* A utility struct that helps mesure the performance of sections of code. Only uses Foundation | |
* (we could also use QuartzCore's CACurrentMediaTime() for similar precision) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Scale a value from one range to another | |
* Example of use: | |
* | |
* // Convert 33 from a 0-100 range to a 0-65535 range | |
* var n = scaleValue(33, [0,100], [0,65535]); | |
* | |
* // Ranges don't have to be positive | |
* var n = scaleValue(0, [-50,+50], [0,65535]); | |
* | |
* Ranges are defined as arrays of two values, inclusive |
OlderNewer