Skip to content

Instantly share code, notes, and snippets.

@rlandas
rlandas / git_commit.sh
Last active November 27, 2015 00:51
GIT Commit and Push committed files to remote repository
function gitcommit {
# get the basename of the current directory
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )";
# retrieve the current COMMIT status of the GIT repo
status=$(git status -s);
# check if there are files that need to be committed
# if there are something to commit, do the git commit process
@rlandas
rlandas / composer_install.sh
Last active November 26, 2015 23:37
COMPOSER Bash script for installing packages
# disable xdebug warning
COMPOSER_DISABLE_XDEBUG_WARN=1
# define timeout
COMPOSER_PROCESS_TIMEOUT=10000
# update composer.phar
composer self-update;
# discard changes in vendors packages
@rlandas
rlandas / apache.ant.check.cli
Created November 24, 2015 00:32
APACHE ANT : Find executable anywhere in the environment PATH
<property environment="env" />
<available file="commandname"
filepath="${env.PATH}"
property="commandname.present"/>
@rlandas
rlandas / COMPOSER_INSTALL_TEST_TOOLS
Last active November 15, 2015 23:06
COMPOSER install testing tools globally
## manually install each
$ composer global require phpunit/phpunit
$ composer global require phpunit/dbunit
$ composer global require phing/phing
$ composer global require phpdocumentor/phpdocumentor
$ composer global require sebastian/phpcpd
$ composer global require phploc/phploc
$ composer global require phpmd/phpmd
$ composer global require squizlabs/php_codesniffer
@rlandas
rlandas / install_ffmpeg_ubuntu.sh
Created November 11, 2015 10:16 — forked from xdamman/install_ffmpeg_ubuntu.sh
UBUNTU Install latest ffmpeg on ubuntu 12.04 or 14.04
#!/bin/bash
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from https://gist.github.com/faleev/3435377
# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
# Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update
@rlandas
rlandas / gulpinstall.sh
Created August 21, 2015 06:02
GULP : Uninstalling and Installing GULP global and local
npm uninstall -g gulp
npm install -g gulp
npm uninstall --save-dev gulp
npm install --save-dev gulp
@rlandas
rlandas / gist:7e72c781b6b64e65403d
Created August 7, 2015 06:33
APACHE : Find the base path of the current URI
RewriteCond %{ENV:URI} ^$
RewriteRule ^(.*)$ - [ENV=URI:$1]
RewriteCond %{ENV:BASE} ^$
RewriteCond %{ENV:URI}::%{REQUEST_URI} ^(.*)::(.*?)\1$
RewriteRule ^ - [ENV=BASE:%2]
# somewhere in the Rewrite
RewriteRule (.*\.less) %{ENV:BASE}less.php?path=$1 [L,NC,QSA]
@rlandas
rlandas / composer.json
Created August 6, 2015 02:20
COMPOSER: ignore PHP extensions - could also work with other required libraries
{
"provide": {
"ext-foo":"*",
"ext-curl":"*"
}
}
@rlandas
rlandas / gist:9773a96c109ed5bc3532
Created July 10, 2015 00:23
APACHE Remove multiple slashes anywhere in the URL
# remove multiple slashes anywhere in url
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
@rlandas
rlandas / gist:45dee9008f9747cc2ef7
Created June 12, 2015 03:49
MySQL - delete all tables in a database
SET @dbName = 'db_name';
SET FOREIGN_KEY_CHECKS = 0;
SET @tables = NULL;
SELECT GROUP_CONCAT(table_schema, '.', table_name) INTO @tables
FROM information_schema.tables
WHERE table_schema = @dbName; -- specify DB name here.
SET @tables = CONCAT('DROP TABLE IF EXISTS ', @tables);
PREPARE stmt FROM @tables;
EXECUTE stmt;