Skip to content

Instantly share code, notes, and snippets.

View patrickmaciel's full-sized avatar
🙏
Jesus is coming!

Patrick Maciel patrickmaciel

🙏
Jesus is coming!
View GitHub Profile
@patrickmaciel
patrickmaciel / filters.php
Created November 20, 2014 11:23
Laravel 4.2 filter for query log
<?php
if (Config::get('app.debug')) {
Event::listen('illuminate.query', function($query, $bindings, $time, $name) {
$data = compact('bindings', 'time', 'name');
// Format binding data for sql insertion
foreach ($bindings as $i => $binding) {
if ($binding instanceof \DateTime) {
$bindings[$i] = $binding->format('\'Y-m-d H:i:s\'');
@patrickmaciel
patrickmaciel / global.filters.js
Last active December 20, 2018 11:18
angular filter para converter uma data (datetime) do mysql para pt_BR #angular
.filter('datetimeToView', ['$filter', function($filter) {
return function(data) {
return $filter('date')(new Date(data).getTime(), 'dd/MM/yyyy HH:mm:ss');
}
}])
// {{ '2014-11-05 12:28:50' | datetimeToView }}
@patrickmaciel
patrickmaciel / gist:569f7ad38e47f01210fd
Last active August 29, 2015 14:07
error when use apm link to install packages in windows 7
Failed to load package named 'atom-color-highlight' Error: Cannot find module 'emissary'
at Function.Module._resolveFilename (module.js:344:15)
at Function.Module._load (module.js:286:25)
at Module.require (module.js:373:17)
at require (module.js:392:17)
at Object.<anonymous> (C:\Users\patrick_campos\Downloads\dev\ide\atom\atom-color-highlight-master\lib\atom-color-highlight.coffee:1:13)
at Object.<anonymous> (C:\Users\patrick_campos\Downloads\dev\ide\atom\atom-color-highlight-master\lib\atom-color-highlight.coffee:1:1)
at Module._compile (module.js:468:26)
at Object.requireCoffeeScript [as .coffee] (C:\ProgramData\chocolatey\lib\Atom.0.136.0\tools\Atom\resources\app\src\coffee-cache.js:61:19)
at Module.load (C:\ProgramData\chocolatey\lib\Atom.0.136.0\tools\Atom\resources\app\node_modules\coffee-script\lib\coffee-script\register.js:45:36)
@patrickmaciel
patrickmaciel / Gruntfile.js
Created September 22, 2014 19:34
Gruntfile.js with grunt-connect-proxy + watch working
// Generated on 2013-12-14 using generator-angular 0.6.0
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'
@patrickmaciel
patrickmaciel / .xinitrc
Created July 28, 2014 03:00
Openbox, compton and Catalyst-hoook slowly in Arch Linux
#!/bin/sh
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)
if [ -d /etc/X11/xinit/xinitrc.d ]; then
for f in /etc/X11/xinit/xinitrc.d/*; do
[ -x "$f" ] && . "$f"
done
@patrickmaciel
patrickmaciel / ataques.rb
Created July 26, 2014 15:22
Blog - Aprendendo Ruby - Modules
# encoding utf-8
module Ataques
def ataqueEspecial
puts "Ataque especial #{fraseDeImpacto}"
end
end
Installing Arch:
sudo vim /etc/pacman.conf
Update packages list: sudo pacman -Syy
run sudo pacman -Syu before installing any software (to update the repositories first)
* Timing issue:
- Change hardware clock to use UTC time:
sudo timedatectl set-local-rtc 0
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" " alternatively, pass a path where Vundle should install plugins
" "call vundle#begin('~/some/path/here')
"
" " let Vundle manage Vundle, required
@patrickmaciel
patrickmaciel / 000-default.conf
Last active August 29, 2015 14:01
Instalando última versão do Apache e PHP no Ubuntu 14.04
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
@patrickmaciel
patrickmaciel / NotificationsController.php
Created April 11, 2014 15:45
Envio de e-mails com CakePHP (exemplo prático)
<?php
App::uses('AppController', 'Controller');
/**
* Notifications Controller
*
* @property Notification $Notification
*/
class NotificationsController extends AppController {