software development

Here is a simple web scraping script I wrote for PhantomJS, the immensely useful headless browser, to load a page, inject jQuery into it, and then scrape the page using a user-supplied jQuery selector. page = require('webpage').create() system = require 'system' phantom.injectJs "static/js/underscore-min.js" page.onConsoleMessage = (msg) -> if not msg.match […]

Simple PhantomJS web scraping script

When writing reports I’ve often come across the need to find the unix timestamp beginning and end of a day. Here is a Python snippet that does just that. yesterday = - datetime.timedelta(days = 1) yesterday_beginning = datetime.datetime(yesterday.year, yesterday.month,,0,0,0,0) yesterday_beginning_time = int(time.mktime(yesterday_beginning.timetuple())) yesterday_end = datetime.datetime(yesterday.year, yesterday.month,,23,59,59,999) yesterday_end_time […]

Finding yesterday’s beginning and ending unix timestamp

While developing apps that use external web services, a proxy often comes in handy in order to bypass the pesky XSS security settings found in most browsers. Here is a simple PHP proxy I’ve found quite helpful.

Simple PHP Proxy

I’ve been dabbling in Erlang recently. I’ve wanted to learn a functional programming language for a while now and Erlang’s concurrency make it rather attractive. For my “hello world” app, I decided to write a simple log parser which processes chunks of a file in parallel. Here is a part […]

Dividing a file into chunks along line endings in Erlang