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), 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. 0: Creating a Master-Detail app For this, we can use a the built-in Master-Detail template. We'll be using…

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. 0: Creating a Master-Detail app For this we will use Xcode's starter template, but with a text view to show the scroll state. Our setup has a few tweaks from…

Unit Testing Redis Lua Scripts

Increase your test coverage! (Photo credit: John Proctor) 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 and making thorough testing difficult. For this reason, I wanted to create a Lua environment which matches the environment available when running the scripts in Redis. This…

Monitoring node.js upstart processes

Tweet Using upstart to detect node.js app crashes Here at Gitter 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 and reporting the state of the server immediately after…

Live Collections using Backbone.js, Faye and Node

Tweet Why LiveCollections? Gitter 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 nicely with Node.js__ We were already using Mongoose.js for Mongo…