Skip to content

Instantly share code, notes, and snippets.

View chasseurmic's full-sized avatar

Michelangelo Chasseur chasseurmic

View GitHub Profile
@chasseurmic
chasseurmic / watermark.sh
Created February 11, 2014 21:27
Xcode 5 build phase to watermark icon with ImageMagick when using new .xcassets
commit=`git rev-parse --short HEAD`
branch=`git rev-parse --abbrev-ref HEAD`
version=`/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${INFOPLIST_FILE}"`
function processIcon() {
export PATH=$PATH:/usr/local/bin
base_file=$1
base_path=`find ${SRCROOT} -name $base_file`
if [[ ! -f ${base_path} || -z ${base_path} ]]; then

Intro

Recently, I had to implement an offline mapping solution for an iOS application. Here's a walkthrough of how to do it.

Summary

I generated a tile database using TileMill. I used the Route-Me iOS library which provides a map view that supports offline tile sources.

TileMill

@chasseurmic
chasseurmic / TWRMacros.h
Created May 24, 2014 14:31
Useful Macros for iOS
//
// TWRMacros.h
// Dispatching
//
// Created by Michelangelo Chasseur on 24/05/14.
// Copyright (c) 2014 Touchware. All rights reserved.
//
#ifndef Dispatching_TWRMacros_h
#define Dispatching_TWRMacros_h
@chasseurmic
chasseurmic / unicorn.rb
Created January 20, 2015 15:58
Basic Unicorn configuration for Rails app
# config/unicorn.rb
worker_processes Integer(ENV["WEB_CONCURRENCY"] || 3)
timeout 15
preload_app true
before_fork do |server, worker|
Signal.trap 'TERM' do
puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
Process.kill 'QUIT', Process.pid
end
@chasseurmic
chasseurmic / Procfile
Created January 20, 2015 16:03
Procfile example for a Unicorn based Rails web app
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb
worker: bundle exec rake jobs:work
@chasseurmic
chasseurmic / Dockerfile
Created January 20, 2015 16:16
Dockerfile example for a Rails app
# Select ubuntu as the base image
FROM ruby:2.2.0
# see update.sh for why all "apt-get install"s have to stay as one long line
RUN apt-get update && apt-get install -y nodejs --no-install-recommends && rm -rf /var/lib/apt/lists/*
# see http://guides.rubyonrails.org/command_line.html#rails-dbconsole
RUN apt-get update && apt-get install -qy postgresql-client sqlite3 imagemagick libmagickwand-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
ENV RAILS_VERSION 4.1.1
@chasseurmic
chasseurmic / clean.sh
Created January 20, 2015 16:18
Clean shell script for Docker build process
echo Restarting boot2docker...
boot2docker down
boot2docker up
echo Exporting Docker variables...
$(boot2docker socket | awk 'NR==1') > /dev/null 2>&1
$(boot2docker socket | awk 'NR==2') > /dev/null 2>&1
$(boot2docker socket | awk 'NR==3') > /dev/null 2>&1
echo Removing orphaned images without tags...
@chasseurmic
chasseurmic / Rakefile
Created January 20, 2015 16:30
Rake tasks for building and deploying Rails app
namespace :docker do
desc "Remove docker container"
task :clean do
sh './clean.sh'
end
desc "Build Docker image"
task :build => [:clean] do
sh 'docker build -t localhost:5000/username/repo_name .'
end
@chasseurmic
chasseurmic / logstash-embedded.conf
Created March 28, 2015 17:50
Logstash Embedded Configuration
input {
tcp {
'port' => "9998"
codec => json
}
udp {
'port' => "9999"
codec => json
}