Skip to content

Instantly share code, notes, and snippets.

View tarla's full-sized avatar

João Tarla tarla

View GitHub Profile
@tarla
tarla / WeatherDataParser.java
Created September 16, 2015 03:22
Udacity Android JSON Parser
// Udacity's code
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class WeatherDataParser {
/**
* Given a string of the form returned by the api call:
@tarla
tarla / asyncTestScalaSpecs2.scala
Last active October 8, 2015 01:28
Async Test using Scala Specs 2
...
"awesome test" in new WithApplication {
/* async */
val x = Future { 1 }
x must beEqualTo(1).await
/* xgh */
val y = Await.result(Future { 1 }, 10 seconds)
y must beEqualTo(1) // whitout .async
@tarla
tarla / .gitconfig
Created February 5, 2016 14:56
Git Configuration
[user]
name = $NAME
email = $EMAIL
[alias]
serve = !git daemon --reuseaddr --verbose --base-path=. --export-all --enable=receive-pack ./.git
hist = !git log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
[push]
default = simple
--colour
--format documentation
--profile
--drb
@tarla
tarla / docker-compose.yml
Created July 31, 2016 16:34
default docker-compose with alpine-postgresql
db:
image: kiasaki/alpine-postgres
ports:
- "5432"
web:
build: .
command: bundle exec rails s -p 9000 -b '0.0.0.0'
environment:
BUNDLE_JOBS: 2
PORT: 9000
@tarla
tarla / Dockerfile
Created July 31, 2016 16:36
default ruby/rails Dockerfile with alpine
FROM ruby:2.3-alpine
MAINTAINER Joao Tarla <joao@tarla.com.br>
ENV BUILD_PACKAGES="curl-dev ruby-dev build-base bash" \
DEV_PACKAGES="zlib-dev libxml2-dev libxslt-dev tzdata yaml-dev postgresql-dev" \
RUBY_PACKAGES="ruby-json yaml nodejs"
RUN apk --update add --no-cache --update\
$BUILD_PACKAGES \
$DEV_PACKAGES \
@tarla
tarla / gh-like.css
Created August 4, 2016 00:48 — forked from somebox/gh-like.css
github markdown css+script with syntax highlighting. Works with http://markedapp.com
/*
Some simple Github-like styles, with syntax highlighting CSS via Pygments.
*/
body{
font-family: helvetica, arial, freesans, clean, sans-serif;
color: #333;
background-color: #fff;
border: none;
line-height: 1.5;
margin: 2em 3em;
image: "ruby:2.3.1"
variables:
POSTGRES_DB: "your_project-test"
POSTGRES_USER: "postgres"
POSTGRES_PASSWORD: ""
RAILS_ENV: "test"
SETUP_DB: "false"
DATABASE_URL: "postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres:5432/$POSTGRES_DB"
@tarla
tarla / Dockerfile
Created June 14, 2017 23:07
Dockerfile
FROM ruby:2.4.1
MAINTAINER "João Tarla" <joao@tarla.com.br>
RUN apt-get update -qq && apt-get install -y -f --force-yes apt-transport-https && \
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5 && \
echo deb http://archive.ubuntu.com/ubuntu precise main universe > /etc/apt/sources.list && \
echo deb http://archive.ubuntu.com/ubuntu precise-updates main universe >> /etc/apt/sources.list && \
echo deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main >> /etc/apt/sources.list && \
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
@tarla
tarla / docker-compose.yml
Created June 14, 2017 23:08
Docker Compose
db:
image: postgres:9.6.3-alpine
ports:
- "5432"
web:
build: .
command: bundle exec rails s -p 9000 -b '0.0.0.0'
environment:
PORT: 9000
links: