Skip to content

Instantly share code, notes, and snippets.

View lucatironi's full-sized avatar

Luca Tironi lucatironi

View GitHub Profile
@lucatironi
lucatironi / Dockerfile
Last active July 24, 2016 21:12
GO Basic Microservice
FROM golang:onbuild
EXPOSE 8080
@lucatironi
lucatironi / server.go
Created July 26, 2016 06:27
Image placeholder microservice
package main
import (
"bytes"
"fmt"
"image"
"image/color"
"image/draw"
"image/jpeg"
"log"
@lucatironi
lucatironi / docker-compose.yml
Created August 6, 2016 09:17
Wordpress Docker
version: '2'
services:
db:
image: mysql:5.7
volumes:
- ./.data/db:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
require 'benchmark/ips'
def simple_fib(n)
return n if [0, 1].include?(n)
simple_fib(n - 1) + simple_fib(n - 2)
end
def rec_fib(n)
rec = -> (a, b, n) { n == 0 ? a : rec.call(b, a + b, n - 1) }
rec.call(0, 1, n)
@lucatironi
lucatironi / list_detail_angularjs.html
Last active April 16, 2017 06:36
List & Detail View with AngularJS
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<meta charset="utf-8">
<title>List & Detail View - AngularJS</title>
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<style type="text/css">
.list-group {
max-height: 420px;
overflow-y:scroll;
@lucatironi
lucatironi / README.md
Last active January 18, 2018 15:00
Docker Compose Jekyll Setup

README

docker-compose run --rm web jekyll new --force .
docker-compose up

Open localhost:4000

@lucatironi
lucatironi / api.rb
Created December 1, 2011 16:12
Snippets for an API with grape
# Server App
# This file must be in lib/myapp/api.rb
module MyApp
module Entities
class Products < Grape::Entity
expose :id, :code, :name, :short_description
expose :description, :unless => { :collection => true }
expose (:category) { |model, options| model.category.name }
expose (:brand) { |model, options| model.brand.name }
end