Skip to content

Instantly share code, notes, and snippets.

View danielpereirabp's full-sized avatar

Daniel Pereira danielpereirabp

View GitHub Profile
@loonies
loonies / 1_phpunit-api.md
Last active January 19, 2024 07:34
PHPUnit Cheat Sheet

PHPUnit API reference

  • version 3.6

TODO

Check those constraints:

$this->anything()
@DaRaFF
DaRaFF / gist:1922267
Created February 27, 2012 07:30
nginx symfony2 example configs
#localtunnel
server {
listen 80;
server_name 3ay5.localtunnel.com;
access_log /var/log/nginx/digital-version.nzz.lo.log;
location / {
root /home/ralphmeier/eos/digital-version/web;
index app_dev.php;
@kixorz
kixorz / aws_autoscaling_cron.rb
Created March 20, 2013 22:41
Running cron jobs in AWS Auto Scaling group is tricky. When you deploy the same code and configuration to all instances in the group, cron job would run on all of them. You may not want that. This script detects the first instance in the group and allows only this instance to run the job. IAM user used by this script needs to have permissions to…
#!/usr/bin/env ruby
require 'syslog'
require 'net/http'
require 'aws-sdk'
Syslog.open
AWS.config({
:access_key_id => '<iam user key>',
:secret_access_key => '<iam user secret>'
@Senhordim
Senhordim / ui.datepicker-pt-BR.js
Created December 28, 2013 01:55
Tradução datepicker pt-BR
/* Brazilian initialisation for the jQuery UI date picker plugin. */
/* Written by Leonildo Costa Silva (leocsilva@gmail.com). */
jQuery(function($){
$.datepicker.regional['pt-BR'] = {
closeText: 'Fechar',
prevText: '&#x3c;Anterior',
nextText: 'Pr&oacute;ximo&#x3e;',
currentText: 'Hoje',
monthNames: ['Janeiro','Fevereiro','Mar&ccedil;o','Abril','Maio','Junho',
'Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'],
@lifuzu
lifuzu / .gitconfig
Created March 11, 2014 17:09
Three levels of GIT config
# There are 3 levels of git config; project, global and system.
# project: Project configs are only available for the current project and stored in .git/config in the project's directory.
# global: Global configs are available for all projects for the current user and stored in ~/.gitconfig.
# system: System configs are available for all the users/projects and stored in /etc/gitconfig.
# Create a project specific config, you have to execute this under the project's directory.
$ git config user.name "John Doe"
# Create a global config
@silasrm
silasrm / phpstorm-vs-sublimetext-shortcuts.md
Last active May 15, 2024 17:03
Teclas de atalhos do PHPStorm com funções semelhantes ao Sublime Text, e outras interessantes.

#Teclas de atalhos do PHPStorm com funções semelhantes ao Sublime Text, e outras interessantes.

Sublime Text PHPStorm Função
CMD+P CMD+Shift+O Busca por arquivos no projeto
CMD+R CMD+F12 (1) Lista os métodos da classe e outros símbolos
CMD+F CMD+F Busca no arquivo
CMD+Option+F CMD+R Busca e troca os valores no arquivo
CMD+Shift+F CMD+Shift+F Busca, busca e troca e outros em um determinado caminho com várias regras.
CMD+D (2) Option+Up (2) Seleciona palavra
@albofish
albofish / outputCSV.php
Last active May 4, 2022 03:02
Laravel Chunk Results to CSV
<?php
/*
* Chunk through result set and output as CSV file in browser.
*/
function outputCSV($columns, $query, $chunkSize = 200) {
header("Content-type: text/csv");
header("Content-Disposition: attachment; filename='export-" . date("YmdHis") . ".csv");
header("Pragma: no-cache");
header("Expires: 0");
@ricardo-rossi
ricardo-rossi / ElasticSearch.sh
Last active December 1, 2023 04:55
Installing ElasticSearch on Ubuntu 14.04
#!/bin/bash
### USAGE
###
### ./ElasticSearch.sh 1.7 will install Elasticsearch 1.7
### ./ElasticSearch.sh will fail because no version was specified (exit code 1)
###
### CLI options Contributed by @janpieper
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch
@Kagami
Kagami / github-proxy-ssh-tunnel-howto.md
Last active March 13, 2024 21:02
Using github through SSH tunnel
# Prerequisites: netcat-openbsd (BSD version of netcat)
$ ssh -fND 127.0.0.1:8081 user@<your-vps>
$ git config --global url."https://github".insteadOf git://github
$ git config --global http.proxy 'socks5://127.0.0.1:8081'
$ echo -e 'Host github.com\nProxyCommand nc -x 127.0.0.1:8081 %h %p' >> ~/.ssh/config

Alternative solutions:

@milon
milon / Controller.php
Last active November 27, 2023 18:32
Delete Modal Popup with Laravel, Bootstrap and jQuery
public function index(){
$categoryList = Category::all();
return view('category.list')->with('categoryList', $categoryList);
}