Skip to content

Instantly share code, notes, and snippets.

View lezi's full-sized avatar
:octocat:

Osvaldo Júnior "mwanalezi" lezi

:octocat:
View GitHub Profile
@lezi
lezi / A-Pen-by-osvaldo-a.-júnior-"mwanalezi".markdown
Created August 21, 2013 13:46
A CodePen by osvaldo a. júnior "mwanalezi".
<?php
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2004 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
/* Drupal theming: Get field values in Drupal 7
Submitted by criz on Thu, 10/06/2011 - 00:54
Drupal 7 has another array structure for storing field values in $node. There is a new array key for the language.
For example:
*/
<?php
$node->field_your_field['en'][0]['value'];
?>
This can be quite useful but makes it difficult to access the right data.
# Puppet manifest for my PHP dev machine
class iptables {
package { "iptables":
ensure => present;
}
@lezi
lezi / drop.sh
Created January 9, 2013 08:53
Delete all tables on mysql database
#!/bin/bash
MUSER="$1"
MPASS="$2"
MDB="$3"
# Detect paths
MYSQL=$(which mysql)
AWK=$(which awk)
GREP=$(which grep)
mysql> SET foreign_key_checks = 0;
mysql> drop table tabela;
mysql> SET foreign_key_checks = 1;
@lezi
lezi / dyn.txt
Created August 17, 2012 09:45
Dynamic Theme on Primefaces
A nice trip to use EL expression to apply a theme dynamically. See following code snippet :
File : web.xml
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>#{loggedInUser.preferences.theme}</param-value>
</context-param>
@lezi
lezi / global_ajax_status_jsf.js
Created July 30, 2012 14:08
Show Global Ajax Status
/**
* ***************************************
* Show busy status.
* Original from POST: http://ocpsoft.org/java/jsf-java/jsf2-how-to-create-a-global-ajax-status-indicator/
*/
if (!window["busystatus"]) {
var busystatus = {};
}
busystatus.onStatusChange = function onStatusChange(data) {
@lezi
lezi / ProcessadorDeRelatorio.java
Created June 27, 2012 12:55
Processador de relatório para jasper
import edu.ucan.util.JSFUtil;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Map;
import javax.activation.MimetypesFileTypeMap;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.servlet.ServletOutputStream;
@lezi
lezi / DownloadFileHandler .java
Created June 25, 2012 21:05
Classe utilitária para download de arquivos com JSF
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletResponse;