TAG: code

Gitter is a communication product for communities and teams on GitHub. Find out more at gitter.im.

Navigation

How to Cache Fragments in Android

If you have an Android app with multiple fragments that are unable save state (e.g they have a WebView [http://developer.android.com/reference/android/webkit/WebView.html#saveState(android.os.Bundle)] ), it can be a real drag to your users when state is lost when navigating around your app. To fix this, we can cache the fragments that your user has visited by using some features of the FragmentManager [http://developer.android.com/reference/…

How to cache view controllers in iOS

If you have an iOS app with multiple child view controllers, it can be annoying when their layout state is lost when switching between them. Scroll View and Web View state are tricky to persist, but we can instead cache the entire view controller with NSCache [https://developer.apple.com/library/prerelease/mac/documentation/Cocoa/Reference/NSCache_Class/index.html] . 0: Creating a Master-Detail app For this we will use Xcode's starter template, but…

Unit Testing Redis Lua Scripts

Increase your test coverage! (Photo credit: John Proctor [https://www.flickr.com/photos/zabdiel/3028620509/]) At Gitter, we love Redis: it's an indispensable tool for us. Redis Lua scripts allow us to execute complex logic in a fast, consitent, atomic manner. Unfortunately, some of our scripts have, over time, grown pretty complex, increasing their cyclomatic complexity [http://en.wikipedia.org/wiki/Cyclomatic_complexity] and making thorough testing difficult. For this reason, I wanted to…

Monitoring node.js upstart processes

Tweet [https://twitter.com/share] Using upstart to detect node.js app crashes Here at Gitter [https://gitter.im] we love writing node.js applications, but like any real-world application, things occassionally go wrong. Nine times out of ten, this is down to an unhandled exception in node.js (although we're seeing a lot less of these since we started using promises extensively). node.js crashes We wanted a way of detecting process crashes…

Live Collections using Backbone.js, Faye and Node

Tweet [https://twitter.com/share] Why LiveCollections? Gitter [https://gitter.im] is a realtime collaborative application. Having a real-time, push-based application, where updates are automatically reflected in the client, is essential. We were keen to leverage the power of Backbone.js, so we decided to extend Backbone with real-time Live Collection capabilities to enable realtime push in Backbone collections. Our aim: create a real-time drop-in replacement for Backbone collections that plays…