Skip to content

Instantly share code, notes, and snippets.

View emtudo's full-sized avatar

Leandro Henrique Reis emtudo

View GitHub Profile
if (!function_exists('array_rows_to_columns')) {
/**
* rows to columns.
*
* @param array $array
* @return array
*/
function array_rows_to_columns(array $data)
{
$newArray = [];
@emtudo
emtudo / auto_sync_git.sh
Last active June 20, 2016 23:37 — forked from gnumoksha/auto_sync_git.sh
Does the git pull of all subdirectories
#!/bin/bash
# This script syncs (i.e. makes git pull) on a specified directory or, se no
# parameter was specified, in all the subdirectories that are git projects.
#
# Usage:
# ./auto_sync_git.sh directory_of_my_project
# ./auto_sync_git.sh
# An alias to the git binary
@emtudo
emtudo / autosyncgithub.sh
Last active July 4, 2016 17:59
Auto Sync github
#!/bin/bash
cd /path/autosync
if [ ! -z "$1" ]; then
if [ -d $1 ] && [ $1 != "." ]; then
cd "$1"
pwd
git pull
fi
exit 0
fi
#!/bin/bash
switchSound() {
NUMBER=$(pacmd list-sinks | grep "* index" | cut -d ' ' -f 5-);
echo $NUMBER;
echo "Setting default sink to: $NUMBER";
pacmd set-default-sink $NUMBER
pacmd list-sink-inputs | grep index | while read line
do
echo "Moving input: ";
@emtudo
emtudo / BaseQueryBuilder.php
Created March 1, 2016 00:58 — forked from vinicius73/BaseQueryBuilder.php
Repo query filter
<?php
namespace App\Support\Queries;
use Illuminate\Database\Query\Builder as QueryBuilder;
use Illuminate\Database\Eloquent\Builder as EloquentQueryBuilder;
use Carbon\Carbon;
abstract class BaseQueryBuilder
{
@emtudo
emtudo / extensions.lua
Created January 28, 2016 09:57 — forked from igmar/extensions.lua
Asterisk LUA dialplan
require("lsqlite3")
-- Igmar: Wanneer closen we dat DB object eigenlijk ?
db = sqlite3.open('/etc/asterisk/users.sqlite')
--CONSOLE = "Console/dsp" -- Console interface for demo
--CONSOLE = "DAHDI/1"
--CONSOLE = "Phone/phone0"
TRUNK = "DAHDI/G1"
#!/bin/bash
####################### ATENCAO #########################
#
# VI ESTA DICA EM ALGUM GIST, MAS NÃO TENHO MAIS A URL
# POREM EU ALTEREI PARA FAZER BACKUP DE TODAS AS BASES
# E ADICIONEI A QUESTÃO DE PODER ADICIONAR O USUÁRIO
# E EMAIL NA LINHA DE COMANDO DO git
#
#########################################################
#se você usar apenas usuário sem senha, use este linha abaixo
@emtudo
emtudo / DateField.php
Last active February 2, 2016 14:11 — forked from vinicius73/CustomValidatorsServiceProvider.php
Helper para datas Laravel
<?php
namespace App\Support\Validators\Rules;
use App\Support\Helpers\Dates as DateHelper;
class DateField
{
/**
* @param string $attribute
<?php namespace App\Exceptions;
use Exception;
use Illuminate\Http\Response;
use App\Exceptions\Handler as BaseExceptionHandler;
class WhoopsHandler extends BaseExceptionHandler {
/**
* Render an exception into a response.
@emtudo
emtudo / Post.php
Last active August 29, 2015 14:26 — forked from vluzrmos/Post.php
Example how to remove the eager loading on Eloquent.
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
/**
* Array of relationships to load.