Index ¦ Archives ¦ RSS

Introducing Verbal, a Ruby Gem

I recently released Verbal, a ruby gem that provides a fluent DSL for creating regular expressions. It's a fork of jehna's popular VerbalExpressions javascript library. Detailed documentation and code examples are available at rubydoc.info.

To create a regular expression that matches http, https, ftp, and sftp, one can use …


Event Tracking with Google Analytics and LaunchRock

It's easy to create a landing page with LaunchRock, but getting meaningful analytics out of it is more difficult. For example, I still have not figured out a way to run a Google Analytics experiment on LaunchRock - using custom Javascript code in LaunchRock sometimes crashes the previewer, forcing me to …


Making Conditional Requests with Peter Murach's gem

GitHub imposes a rate limit on API requests, and encourages developers to use conditional requests. Here is how to do that using Peter's popular github api gem.

Method A - Faraday HTTP Cache w. ActiveSupport::Cache

This uses the faraday-http-cache gem, which takes care of expiration, etags, and response statuses.

Method …


jQuery Plugin - Box Lid Menu

Smashing Magazine wrote a piece about Toybox's navigation menu today, describing the user experience as "peeking behind the page or the lid of a toybox". I really liked the design, took a shot at creating a jQuery plugin to replicate the effect. Here is a demo.

Most of the …


A Short Tutorial on Custom Storyboard Segues

This is a repost from my old blog.

We will use the last tutorial as a base to learn how to use custom segues.

Suppose you don't want to push between view controllers. In particular, suppose you want first view controller to flip to the second view controller. To achieve …


Compiling open source libraries with Android NDK: Part 2

This is a repost from my old blog.

For the second part of this series, we will deal with the compiling of open source libraries that have several makefiles.

Android NDK r5 added support for prebuilt libraries and also included standalone toolchains that could be used to compile open-source libraries …


Implementing a Singleton in iOS

This is a repost from my old blog.

While I was at Apple’s Cocoa Camp over summer, one of the speakers talked rather passionately about the proper, thread-safe way to implement a singleton in iOS, which I thought deserves more attention than it currently does on the Web.

The …


Using Karma with Rails and Jenkins: Part 1

In a recent project, I experimented with AngularJS on Rails, and managed to get Karma to work nicely with Jenkins on CloudBees. This post documents the steps I took. (Part 2 will cover e2e tests, if I get that sorted out.)

An example project is available on GitHub.

Setup

First …


Playing with Stripe CTF

I was playing around with Stripe's source code for last year's CTF, and from what I could see online, most people solved Level 4 by using XSS in the password field. But look at the following line in srv.rb:

unless username =~ /^\w+$/
  ie("Invalid username. Usernames must match /^\w …

Experimenting with Git Hooks

I have been trying to follow a more disciplined approach to branching in my projects to allow easier tracking and regression. For example, I learnt that it's a good idea to prefix branch names with category tokens, such as feature/, bug/, or chore/. This allows us to use wildcards when …

© James Lim. Built using Pelican. Theme by Giulio Fidente on github.