Skip to content

Instantly share code, notes, and snippets.

View Exadra37's full-sized avatar

Paulo Renato Exadra37

View GitHub Profile
@Exadra37
Exadra37 / php-methods.php
Created February 12, 2014 16:58
some usefull php methods
<?php
/**
* Converts a CamelCase word into snake_case
* - improved version of http://stackoverflow.com/a/19533226
* - this version avoid failing when using the $input = "_ThisIsATest_To_check_this"
* . stack overlow answer will output "__this_is_atest__to_check_this"
* . this improved version will output "this_is_a_test_to_check_this"
*
* @author Exadra37 exadra37 in gmail point com
@Exadra37
Exadra37 / uninstall-mysql.sh
Created October 14, 2014 17:05
Uninstall / Remove Mysql completely from your Server system
#!/bin/bash
#
# Will uninstall / remove completely mysql from your system
# This script was done to work in Ubuntu 13.10, but can be easily modified to work in other distributions
#
# @author Exadra37
# @version 1.0.0
# @since 14/10/2014
# @see http://askubuntu.com/a/172516
# http://stackoverflow.com/a/16178696
@Exadra37
Exadra37 / unicorn.rb
Created January 5, 2015 12:47
Fix Gitlab error 502 in order allow processing hudge differences
# by Exadra37
# this will allow gtilab to process hudge diffrences
# restart gitlab to apply changes
# change from 30 to 300
timeout 300
@Exadra37
Exadra37 / importCsvToDatabase.sh
Last active August 29, 2015 14:12
Import CSV file to database and creates a backup table.
#!/bin/bash
# @author Paulo Silva <exadra37atgmailpointcom>
# @since 2014/08/20
echo -e "\n Import CSV File to Database \n";
error=0;
if [ "$1" != "-h" ] || [ "$1" != "--help" ]
then
@Exadra37
Exadra37 / debug_vars.php
Last active August 29, 2015 14:12
Debug On Screen, restricted by Ip Address, several vars at once, using var_dump() or print_r()
<?php
/**
* @author Exadra37 <exadra37atgmailpointcom>
* @since 2014/01/03
*/
if (!function_exists('debugOnScreen')) {
function debugOnScreen(array $vars, $print_r = false, $die = false)
<?php
/**
* The helper function inside section DEBUG will allow to use var_dump and print_r
* with an formatted output.
*
* The functions ddv(), ddp(), dv(), dp() will cal dump(),
* that for is turn will call isAllowedToDebug() to check if we need to check the ip address
* and in that case if the remote ip address is in the allowed ip addresses.
*
@Exadra37
Exadra37 / BasicTestCase.php
Created June 4, 2015 14:11
More robust testing for the methods we are testing
<?php
/**
* @author Paulo Silva(Exadra37) <exadra37ingmaildotcom>
* @since 2015/06/04
*/
abstract class BasicTestCase extends PHPUnit_Framework_TestCase // Orchestra\Testbench\TestCase for Laravel
{
/**
@Exadra37
Exadra37 / Tools.php
Last active September 11, 2015 16:04
Usefull Tools class
<?php
/**
*
* @author Exadra37
* @package exadra37/tools
* @version 1.0.0
* @since 1.0.3 - 19/09/2014
* 1.0.2 - 15/09/2014
* 1.0.1 - 15/09/2014
@Exadra37
Exadra37 / .vimrc
Last active September 18, 2015 19:43
My personnal Vim Configuration
set smartindent
set tabstop=4
set shiftwidth=4
set expandtab
set statusline="%f%m%r%h%w [%Y] [0x%02.2B]%< %F%=%4v,%4l %3p%% of %L"
nnoremap <F2> :set invpaste paste?<CR>
set pastetoggle=<F2>
set showmode
set nu
@Exadra37
Exadra37 / getColumnsNamesFromMysqlTable.php
Created January 24, 2014 17:21
This is a function easily convertible into a method to use inside of a class that as the name says, get columns names from mysql table, will return all the columns names from a given table in the provided database. The mysql connection used is the native PHP driver PDO.
<?php
/**
*
* @author Paulo Silva(Exadra37) exadra37 in gmail point com
* @package exadra37/PDO
* @version 0.0.1
* @since 24/01/2014
*
*/