Skip to content

Instantly share code, notes, and snippets.

View Exadra37's full-sized avatar

Paulo Renato Exadra37

View GitHub Profile
@Exadra37
Exadra37 / synchronize-prestashop-fork.sh
Created March 18, 2015 22:46
Maintain your Prestashop fork synchronized / updated with the original repository.
#!/bin/bash
# @author Exadra37 <exadra37ingmailpointcom>
# @since 2015/03/18
# @link exadra37.com
# @see Heavily inspired in http://stackoverflow.com/a/7244456
#
#
# I use this script to update my Prestashop fork when i want to make a contribution
#
<?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 / 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)
@Exadra37
Exadra37 / laravel-tips.md
Last active December 5, 2017 19:23
Laravel Tips

LARAVEL TIPS

4. Bulk Insert On Duplicate Key Update

<?php
    /**
     * When we want to perform a bulk insert we will not found support for this action in Eloquent or Query Builder
     * To avoid performance issues i have to drop my preference to be database agnostic in my Apps
     * To be used like:
     *     $table   = 'table_name';
@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 / 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 / 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 / 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 / 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>