Skip to content

Instantly share code, notes, and snippets.

View alfonsodev's full-sized avatar
🏠

Alfonso alfonsodev

🏠
View GitHub Profile
@alfonsodev
alfonsodev / postgres.timezones.md
Last active August 29, 2015 14:18
Postgreesql timezones

By default postgres should be in UTC , show timezone; if it isn't change configuration timezone = 'UTC' in postgresq.conf

Store dates always in UTC, no mather user timezone, use AT TIME ZONE '' to convert it your query.

To know a list of valid values select * from pg_timezone_names;

@alfonsodev
alfonsodev / postgrest-and-kong.md
Created July 22, 2015 10:40
Kong to manage postgrest security

docker run -p 9042:9042 -d --name cassandra mashape/cassandra
docker run -p 8000:8000 -p 8001:8001 -d --name kong --link cassandra:cassandra mashape/kong
docker run -it --name pgb --rm -e POSTGRES_PASSWORD=pass postgres
docker run -itp 8000:8000 --link pgb:postgres -e POSTGRES_DB_NAME=tracker biscarch/postgrest

@alfonsodev
alfonsodev / xdebug.md
Last active March 7, 2017 03:44
Setting up xdebug in ubuntu phpstorm

Setting up xdebug (ubuntu) and Phpstorm

sudo pecl install xdebug
sudo touch /etc/php5/mods-available/xdebug.ini
edit /etc/php5/mods-available/xdebug.ini and paste this content in to the file:

zend_extension=/usr/lib/php5/20100525/xdebug.so
xdebug.remote_enable=1
xdebug.remote_connect_back=1
xdebug.remote_port=9000
xdebug.show_local_vars=0
@alfonsodev
alfonsodev / install-comodo-ssl-cert-for-nginx.rst
Last active September 17, 2015 09:00 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@alfonsodev
alfonsodev / main.go
Created September 22, 2015 14:14 — forked from shirou/main.go
ansible module written in go-lang. This is almost same as http://ansible.cc/docs/moduledev.html#reading-input
package main
import (
"fmt"
"os"
"io/ioutil"
"strings"
"time"
"encoding/json"
)

This is my response to an email asking about Domain-Driven Design in golang project.

Thank you for getting in touch. Below you will find my thoughts on how golang works with DDD, changing it. This is merely a perception of how things worked out for us in a single project.

That project has a relatively well-known domain. My colleagues on this project are very knowledgeable, thoughtful and invested in quality design. The story spelled out below is a result of countless hours spent discussing and refining the approach.

Conclusions could be very different, if there was a different project, team or a story-teller.

Short story

@alfonsodev
alfonsodev / playSound.m
Created January 15, 2016 12:36
Play a sound file in ObjC
// from http://codewithchris.com/avaudioplayer-tutorial/
@interface ViewController ()
{
AVAudioPlayer *_audioPlayer;
}
@end
// Construct URL to sound file
@alfonsodev
alfonsodev / delegate.md
Last active January 27, 2016 18:38
objectivec delegates

notes taken from : https://www.youtube.com/watch?v=YVikeoR3gYg Communicating between two viewControllers

in the SecondViewController.m

  - (void)saveText {
    [self.delegate sendTextToViewController:@"name here"];
  }

in the SecondViewController.h

@alfonsodev
alfonsodev / react-native-RNFS.js
Created February 3, 2016 18:08
React-native read bundle dir
var RNFS = require('react-native-fs');
// Read theRNFS.MainBundlePath song and playit
RNFS
.readDir(RNFS.MainBundlePath)
.then((result) => {
AudioPlayer.playWithUrl(result[0].path)
console.log('Audio should play');
});
@alfonsodev
alfonsodev / gist:24fd06c598f97cd2bbde
Created February 18, 2016 14:53 — forked from billhathaway/gist:e32060b96802d74ca586
Getting IronMQ on-premise running in Vagrant
# more detailed instructions are at http://dev.iron.io/mq-onpremise/getting_started
# Get a coreos VM up
git clone https://github.com/coreos/coreos-vagrant.git
cd coreos-vagrant/
vagrant up
# get into the coreos box
vagrant ssh