Skip to content

Instantly share code, notes, and snippets.

@gtrias
gtrias / vim74_lua
Last active August 29, 2015 14:16 — forked from jdewit/vim74_lua
sudo apt-get remove --purge vim vim-runtime vim-gnome vim-tiny vim-common vim-gui-common
sudo apt-get build-dep vim-gnome
sudo apt-get install liblua5.1-dev luajit libluajit-5.1 python-dev ruby-dev libperl-dev mercurial libncurses5-dev libgnome2-dev libgnomeui-dev libgtk2.0-dev libatk1.0-dev libbonoboui2-dev libcairo2-dev libx11-dev libxpm-dev libxt-dev
sudo rm -rf /usr/local/share/vim
sudo rm /usr/bin/vim
@gtrias
gtrias / twitter-bootstrap-remote-modal.js
Created April 10, 2015 11:14
twitter-bootstrap-remote-modal
// Remove contents when close to avoid show the same while next modal is loading
// Source: http://stackoverflow.com/a/22051611/865222
$(document).on("hidden.bs.modal", ".modal:not(.local-modal)", function (e) {
$(e.target).removeData("bs.modal").find(".modal-content").empty();
});
@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
@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 / 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 / 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 / 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 / .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 / 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 / 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