Skip to content

Instantly share code, notes, and snippets.

@gtrias
gtrias / fromGit2Svn.sh
Last active August 29, 2015 14:26
Push existing git repository to existing svn repository
# Clone the svn repository
$ git svn clone http://svn.example.com/project/trunk # Important to clone the trunk folder
$ cd trunk
$ git checkout -b mywork
$ git pull /path/to/current/work/repository/.git master
#Merge and "push"
$ git checkout master
@gtrias
gtrias / sslredirect.conf
Created July 28, 2015 10:57
Apache redirect to HTTPS
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.example.com
Redirect permanent / https://secure.example.com/
</VirtualHost>
<VirtualHost _default_:443>
ServerName secure.example.com
DocumentRoot /usr/local/apache2/htdocs
SSLEngine On
@gtrias
gtrias / cake3ORMMatching.php
Created July 27, 2015 16:01
Cakephp3 - Retrieve entity based on related entity conditions
<?php
...
$this->loadModel('Posts');
$posts = $this->Posts
->find('all')
->limit(6)
->contain([
'Filed.Files',
'Filed.Thumbs',
@gtrias
gtrias / .bashrc
Created July 25, 2015 15:58
Setting up GOPATH ubuntu 15.04
export GOPATH=$HOME/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
@gtrias
gtrias / service
Created July 24, 2015 22:52
Docker upstart script
description "Redis container"
author "Me"
start on filesystem and started docker
stop on runlevel [!2345]
respawn
script
/usr/bin/docker start -a redis_server
end script
@gtrias
gtrias / mysql_error_codes.txt
Created July 23, 2015 09:20
Mysql error codes
OS error code 1: Operation not permitted
OS error code 2: No such file or directory
OS error code 3: No such process
OS error code 4: Interrupted system call
OS error code 5: Input/output error
OS error code 6: No such device or address
OS error code 7: Argument list too long
OS error code 8: Exec format error
OS error code 9: Bad file descriptor
OS error code 10: No child processes
@gtrias
gtrias / README.md
Last active February 9, 2016 12:29 — forked from tjamps/README.md
Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

The API we are creating in this gist will follow these rules :

  • The API only returns JSON responses
  • All API routes require authentication
  • Authentication is handled via OAuth2 with password Grant Type only (no need for Authorization pages and such).
  • API versioning is managed via a subdomain (e.g. v1.api.example.com)

The API will be written in PHP with the Symfony 2 framework. The following SF2 bundles are used :

@gtrias
gtrias / alert.js
Created June 22, 2015 10:38
ng-class usage
'use strict';
/**
* @ngdoc function
* @name davantisApiClient.controller:AlertCtrl
* @description
* # AlertCtrl
* Controller of the davantisApiClient
*/
angular.module('davantisApiClient')
@gtrias
gtrias / vimrc_if_exists.vim
Created April 23, 2015 13:39
Load per project vimrc if exists
" Load per project vimrc if exists {
let b:projectconf = getcwd() . "/.vimrc"
if (filereadable(b:projectconf))
exe "source" . b:projectconf
endif
" }
@gtrias
gtrias / macro.conf
Created April 23, 2015 07:44
Apache macro to local developing
<Macro VirtualHost $host $path>
ServerName $host.loc
ServerAlias www.$host.loc
ServerAlias $host.gemenon.cir
ServerAlias www.$host.gemenon.cir
ServerAdmin genar@cirici.com
DocumentRoot /home/genar/src/$path