Skip to content

Instantly share code, notes, and snippets.

Michelangelo Chasseur chasseurmic

View GitHub Profile
@chasseurmic
chasseurmic / logstash-embedded.conf
Created Mar 28, 2015
Logstash Embedded Configuration
View logstash-embedded.conf
input {
tcp {
'port' => "9998"
codec => json
}
udp {
'port' => "9999"
codec => json
}
@chasseurmic
chasseurmic / Rakefile
Created Jan 20, 2015
Rake tasks for building and deploying Rails app
View Rakefile
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 / clean.sh
Created Jan 20, 2015
Clean shell script for Docker build process
View clean.sh
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 / Dockerfile
Created Jan 20, 2015
Dockerfile example for a Rails app
View Dockerfile
# 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 / Procfile
Created Jan 20, 2015
Procfile example for a Unicorn based Rails web app
View Procfile
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb
worker: bundle exec rake jobs:work
@chasseurmic
chasseurmic / unicorn.rb
Created Jan 20, 2015
Basic Unicorn configuration for Rails app
View unicorn.rb
# 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 / TWRMacros.h
Created May 24, 2014
Useful Macros for iOS
View TWRMacros.h
//
// 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
View offline_map.md

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 / watermark.sh
Created Feb 11, 2014
Xcode 5 build phase to watermark icon with ImageMagick when using new .xcassets
View watermark.sh
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
You can’t perform that action at this time.