Skip to content

Instantly share code, notes, and snippets.

View lnaia's full-sized avatar
🏠
Working from home

Luis Naia lnaia

🏠
Working from home
View GitHub Profile
sub filterTicketsByQueue {
my $self = shift;
my $queue = shift;
my $current_user = new RT::CurrentUser;
$current_user->LoadByName('RT_System');
my $tickets = new RT::Tickets($current_user);
$tickets->LimitQueue(
@lnaia
lnaia / ValidationField.php
Last active September 16, 2015 08:37
I would attempt the refactoring of method "extractContraints" here https://github.com/bichotll/FormValidationBundle/blob/master/Generator/ValidationField.php to the following:
<?php
namespace Bic\FormValidationBundle\Generator;
use Symfony\Component\DependencyInjection\ContainerAware;
use Symfony\Component\DependencyInjection\ContainerInterface;
class ValidationField extends ContainerAware {
/**

Keybase proof

I hereby claim:

  • I am darkbls on github.
  • I am darkbluesea (https://keybase.io/darkbluesea) on keybase.
  • I have a public key whose fingerprint is 5389 079C 79A0 B2D8 7A5C C63C 7EB5 0BBD 3759 921D

To claim this, I am signing this object:

@lnaia
lnaia / Display.html
Last active August 29, 2015 13:59
Default Display.html with logger messages.
%# BEGIN BPS TAGGED BLOCK {{{
%#
%# COPYRIGHT:
%#
%# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC
%# <[email protected]>
%#
%# (Except where explicitly superseded by other copyright notices)
%#
%#
@lnaia
lnaia / ArticlesModel.php
Last active August 29, 2015 14:00
Articles model using a pdo wrapper
<?php
namespace Model;
class Articles
{
const DB_DSN = "mysql:host=localhost;dbname=DN_NAME_GOES_HERE";
const DB_USERNAME = 'DB_USER_GOES_HERE';
const DB_PASSWORD = 'DB_PASSWORD_GOES_HERE';
public static function find()
Eles não sabem que o sonho
é uma constante da vida
tão concreta e definida
como outra coisa qualquer,
como esta pedra cinzenta
em que me sento e descanso,
como este ribeiro manso,
em serenos sobressaltos,
como estes pinheiros altos,
que em oiro se agitam,
@lnaia
lnaia / simpleimageproxy.php
Last active August 29, 2015 14:02
Lazy friends, that cannot access some images, because of firewalls at their work. Lazy because they cannot code a simple way around. :(
<?php
try {
$image_path = $_GET['image'];
if (strlen($image_path) < 4){
echo 'n/a';
return;
}
$http = substr($image_path, 0, 4);
@lnaia
lnaia / brewdock.lunch.txt
Last active August 29, 2015 14:03
Is the food healthy ? Just having fun with random menus from nearby places
SOUP OF THE DAY...............................................450
Served with wholemeal bread
FRESH CUT CHUNKY CHIPS ...................................450
With sweet chilli mayo
FRIED CHICKEN WRAP .........................................700
With mixed leaves, tomato and chilli mayo
FALAFEL WRAP ....................................................700
Spicy chickpea patty with lettuce, tomato, red onion and garlic mayo (v)
HAM AND CHEESE TOASTIE ..................................500
On buttered toast with tomato and red onion, “no messin”
@lnaia
lnaia / reorder.js
Created August 15, 2014 09:13
re order log text on browser
var text = document.body.textContent.split("\n")
text.pop();
text = text.reverse().join("\n");
var pre = document.createElement('pre');
pre.style.wordWrap = "break-word";
pre.style.whiteSpace = "pre-wrap";
pre.innerHTML = text;
document.body.innerHTML = '';
document.body.appendChild(pre)
@lnaia
lnaia / calculate_income.rb
Created August 20, 2014 12:19
Calculate irish net income
=begin
Tax Income
20% up to 32,800€
41% above 32,800€
Universal Social Charge (USC)
2% first 10,036€
4% next 5,980€
7% on balance