Skip to content

Instantly share code, notes, and snippets.

View Exadra37's full-sized avatar

Paulo Renato Exadra37

View GitHub Profile
@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
*
*/
@Exadra37
Exadra37 / getAllColumnsNamesFromMysqlTable.php
Last active January 4, 2016 09:49
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. The difference to other one that i also have here in Gist is that this one u…
<?php
/**
* getAllColumnsNamesFromMysqlTable.php
*
* @author Paulo Silva(Exadra37) exadra37 in gmail point com
* @package exadra37/PDO
* @version 0.0.2
* @since 24/01/2014 - v.0.0.1
* 25/01/2014 - v.0.0.2
@Exadra37
Exadra37 / mysql_querys.sql
Created January 28, 2014 20:18
Examples of some raw mysql querys: Insert Into.. On Duplicate Key Update
/**
*
* @author Paulo Silva(Exadra37) exadra37 in gmail point com
* @package Exadra37/Mysql-Examples
* @version 0.0.1
* @since 28/01/2014 - v.0.0.1
*
*/
INSERT INTO stores (storeName, address, phone)
@Exadra37
Exadra37 / secure-phpmyadmin-installation.txt
Last active June 21, 2022 05:46
Secure PhpMyAdmin installation in 3 steps, by restrict access for specific users from specific ip addresses and change the alias name from phpmyadmin to other name less obvious.
/**
* - Securing PhpMyAdmin instalation in Ubuntu server
*
* @author Paulo Silva(Exadra37) <exadra37ingmailpointcom>
* @package Exadra37/SecurePhpMyAdmin
* @version 1.0.1
* @since 30/01/2014 - v.1.0.0
* 05/06/2014 - v.1.0.1
*
*/
@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 / UserAgentDetector.php
Last active August 17, 2016 05:42
Class to detect the user agent from the global var $_SERVER. Detects if is a bot, spider, crawler based on the HTTP_USER_AGENT and a list of web sniffers names or types.
<?php
/**
* UserAgentDetector
*
* @author Exadra37
* @license Free to use at your own risk. Provided as it is, without any warranty that will work for you.
* @link http://presta-hosting.com
* @version 1.0.1
* @since v.1.0.0 - 09/03/2014
@Exadra37
Exadra37 / exadra37.html
Last active February 11, 2020 17:02
Allow only 1 Selection by Group when using multiselect in option groups boxs with plugin https://github.com/silviomoreto/bootstrap-select
<!-- http://silviomoreto.github.io/bootstrap-select/ -->
<select id="compare" class="selectpicker" data-style="btn-success" data-max-options="2" title="Compare Settings" data-width="25em" multiple>
<optgroup class="multiple-options" label="Compare" data-max-options="1">
<option class="exadra37-1-selection-by-group exadra37-group-compare" title="Compare Daily" selected>Daily</option>
<option class="exadra37-1-selection-by-group exadra37-group-compare" title="Compare Weekly">Weekly</option>
<option class="exadra37-1-selection-by-group exadra37-group-compare" title="Compare Monthly">Monthly</option>
</optgroup>
<optgroup class="multiple-options" label="Against" data-max-options="1">
<option class="exadra37-1-selection-by-group exadra37-group-against" title="Against Previous Week" selected>Previous Week</option>
<option class="exadra37-1-selection-by-group exadra37-group-against" title="Against Last Year">Last Year</option>
@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 / 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 / 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