Skip to content

Instantly share code, notes, and snippets.

View fernando-basso's full-sized avatar

fernando-basso

View GitHub Profile
<?php
public function getDepartamentos() {
$sql = 'SELECT id, nome, descricao FROM departamento';
if ( $this->pesq != NULL && $this->pesq != 'off' ) {
$sql .= " WHERE nome ILIKE '%:pesq%'"; //OR descricao ILIKE '%:pesq%'";
}
// There will always be a default ord, even if no one was provided.
$sql .= " ORDER BY {$this->ord}";
@fernando-basso
fernando-basso / index.php
Last active December 22, 2015 13:39
How to get rid of all those hardcoded url parameters and long IFs in the controller?
<?php
header( 'Content-Type: text/html; charset=utf-8' );
require_once 'inc/init.php';
////////////////////////////////////////////////////////////////////
/// VARIÁVEIS PADRÃO PARA EXECUÇÃO DAS AÇÕES ///////////////////////
$menu = Util::getVar( 'm', Util::REQUEST );
$acao = Util::getVar( 'acao', Util::REQUEST );
$id = Util::getVar( 'id', Util::REQUEST );
$url = "?m={$menu}";
@fernando-basso
fernando-basso / GalleryUp.php
Created August 30, 2013 21:52
Multiple upload with javascript + Imagick
<?php
class GalleryUp {
/**
*
* @var PDO Uma conexão estática com PDO (singleton).
*/
private $db;
@fernando-basso
fernando-basso / proxy.bash
Last active April 25, 2023 06:43
Proxy functions. Place them in $HOME/.bashrc or in a differente file, and then source it from bashrc, or source it manually when needed. The file extension is merely illustrative.
#!/usr/bin/env bash
# gsettings list-recursively org.gnome.system.proxy
# Change de ip address and port number accordingly.
function myProxyOn() {
gsettings set org.gnome.system.proxy mode 'manual' # ' manual / nome / automatic '
gsettings set org.gnome.system.proxy.http host '10.0.0.1'
gsettings set org.gnome.system.proxy.http port 8080
gsettings set org.gnome.system.proxy.https host '10.0.0.1'
window.onload = function() {
var value = getParam( 'detalhes' );
if ( getParam( 'tipo' ) == 'casa' ) {
out ( getParam( 'tipo' ) );
}
}
var out = console.log;
function __autoload( $class_name ) {
if ( file_exists( 'model/class.' . $class_name . '.inc.php' ) ) {
include 'model/class.' . $class_name . '.inc.php';
}
if ( file_exists( 'dao/dao.' . $class_name . '.inc.php' ) ) {
include( 'dao/dao.' . $class_name . '.inc.php' );
}
}
background yes
#font Sans:size=8
xftfont Dejavu Sans:size=9
use_xft yes
xftalpha 0.1
update_interval 5.0
total_run_times 0
own_window yes
#own_window_dekstop