A Pen by osvaldo a. júnior "mwanalezi" on CodePen.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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: | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Puppet manifest for my PHP dev machine | |
class iptables { | |
package { "iptables": | |
ensure => present; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
MUSER="$1" | |
MPASS="$2" | |
MDB="$3" | |
# Detect paths | |
MYSQL=$(which mysql) | |
AWK=$(which awk) | |
GREP=$(which grep) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql> SET foreign_key_checks = 0; | |
mysql> drop table tabela; | |
mysql> SET foreign_key_checks = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* *************************************** | |
* 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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |