Skip to content

Instantly share code, notes, and snippets.

@vbernabe
vbernabe / Dockerfile
Created November 30, 2018 02:51
This is a custom dockerfile that uses PHP 7.3 with FPM. Also includes the imagemagick, mysql pdo and other libraries. Use this with the docker-compose.yml to kickstart your PHP Development environment
FROM php:7.3-rc-fpm
RUN docker-php-ext-install pdo_mysql && docker-php-ext-enable pdo_mysql
RUN docker-php-ext-install mysqli && docker-php-ext-enable mysqli
# Install libraries
RUN apt-get update && \
apt-get -y install \
gnupg2 && \
apt-key update && \
apt-get update && \
@vbernabe
vbernabe / docker-compose.yml
Last active September 9, 2019 08:28
Use this boiler plate for development that will setup php, nginx, redis, mariadb, composer. You need my Dockerfile to setup custom libraries
# vbernabe
# This is a docker config to run containers with nginx, php, mariadb, redis, composer, adminer
# Environment variables setup the db user and pass so use it to connect
# Volumes will map the folder from your host machine to the container
# Links I use links to let the app container know to connect to the db container
version: "3.1"
services:
php:
build:
context: .
@import url(https://fonts.googleapis.com/css?family=Roboto:400,700,500,300);@import url(https://fonts.googleapis.com/css?family=Roboto+Mono:400,700,500,300);@keyframes a{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}@keyframes b{0%{opacity:1}50%{opacity:0}to{opacity:1}}[src$="blue.png"]{background-image:url(data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjE4IiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIxOCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDA5Njg4IiBkPSJNMTIgMkM2LjQ4IDIgMiA2LjQ4IDIgMTJzNC40OCAxMCAxMCAxMCAxMC00LjQ4IDEwLTEwUzE3LjUyIDIgMTIgMnptLTIgMTVsLTUtNSAxLjQxLTEuNDFMMTAgMTQuMTdsNy41OS03LjU5TDE5IDhsLTkgOXoiLz48L3N2Zz4=)}[src$="red.png"]{background-image:url(data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjE4IiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIxOCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjRjQ0MzM2IiBkPSJNMTIgMkM2LjQ4IDIgMiA2LjQ4IDIgMTJzNC40OCAxMCAxMCAxMCAxMC00LjQ4IDEwLTEwUzE3LjUyIDIgMTIgMnptMSAxNWgtMnYtMmgydjJ6bTAtNGgtMlY3aDJ2NnoiLz48L3N2Zz4=)}[src$="yellow.png
@vbernabe
vbernabe / mongo_count_per_month
Created June 19, 2014 04:46
MongoDB: Count item created per year month using ObjectId as timestamp (map - reduce)
db.accounts.mapReduce(
// Map function. Convert object id to timestamp then extract year-month
function(){
var ac_create_date = this._id.getTimestamp();
var year = ac_create_date.getFullYear();
var month = ac_create_date.getMonth()+1;
emit(year+"-"+month, 1);
},
// Reduce function. Just sum up the values from map.
function(key, value){