Skip to content

Instantly share code, notes, and snippets.

View pelusium's full-sized avatar

Mauro Gama pelusium

View GitHub Profile
@pelusium
pelusium / home.tpl
Created August 22, 2013 20:06
Ir buscar imagens aos subitems dos objectos!
{$quartos_suites.assigned_nodes.0.children.0.data_map.content.original.full_path|attribute("show",1)}
@pelusium
pelusium / convention-bureau-detalhe.tpl
Created August 29, 2013 10:48
Quando não é possivel obter o link através do node, podemos usar este snippet!
{def $node_actual = $node.url_alias|ezurl('no','full')}
{def $url_actual = concat(concat($node_actual|ezurl('no','full'),"/(n)/"),$nomeAssociado)|ezurl( 'no' )}
@pelusium
pelusium / facebook-sdk.tpl
Created August 29, 2013 10:50
Obter a lingua actual do sistema
{def $locale = ezini( 'RegionalSettings', 'Locale', 'site.ini' )}
@pelusium
pelusium / me-no-mundo-europa.tpl
Created September 13, 2013 09:43
- Filter by class - get children/parent/grandparent
{def $areas_negocio_list = fetch( 'content', 'list',
hash( 'parent_node_id', $areas_negocio_id.node_id, 'class_filter_type', 'include',
'class_filter_array', array( 'folder' ),
'depth', 3 ) )}
{def $dep = 0}
{def $number_children = 0}
{foreach $areas_negocio_list as $area_negocio}
@pelusium
pelusium / content.ini.append.php
Created September 30, 2013 16:05
vimeo custom tag
AvailableCustomTags[]=vimeo
IsInline[vimeo]=true
[vimeo]
CustomAttributes[]=width
CustomAttributes[]=height
CustomAttributes[]=link
CustomAttributesDefaults[width]=610
CustomAttributesDefaults[height]=400
CustomAttributesDefaults[link]=
@pelusium
pelusium / path_info
Created March 12, 2014 15:25
Laravel - Path Folder
**
* Path to the 'app' folder
*/
echo app_path();
/**
* Path to the project's root folder
*/
echo base_path();
/**
* Path to the 'public' folder
@pelusium
pelusium / .gitignore
Created June 18, 2014 09:35
gitignore
### Laravel ###
_ide_helper.php
/bootstrap/compiled.php
/vendor
.env.local.php
.env.php
composer.phar
composer.lock
@pelusium
pelusium / WriteToSlack
Last active August 29, 2015 14:15
L4 - Write to Slack
<?php
class WriteToSlack {
public function write($params){
$type = $params['type'];
if($type == "error")
@pelusium
pelusium / isValidPhoneNumber.js
Last active January 11, 2017 14:55
Regex telefone PT
jQuery.validator.addMethod('isValidPhoneNumber', function(value, element) {
var regex = new RegExp('^[0-9]{9}$');
var isValid = true;
if(value.charAt(0) != 2 && value.charAt(0) != 3 && value.charAt(0) != 9 ) isValid = false;
if( (value.charAt(0) == 9) && (value.charAt(1) != 6 && value.charAt(1) != 1 && value.charAt(1) != 3 && value.charAt(1) != 2 && value.charAt(1) != 4)) isValid = false;
if (value.charAt(0) == 3 && value.charAt(1) == 5 && value.charAt(2) == 1) isValid = false;
if(formValidation_isInvalidPhoneNumbers(value)) isValid = false;
return this.optional(element) || (regex.test(value) && isValid)
});
function formValidation_isInvalidPhoneNumbers( phone ){
@pelusium
pelusium / isValidName.js
Created January 11, 2017 14:57
Validate Name PT
jQuery.validator.addMethod('isValidName', function(value, element) {
var regex = /(^([ A-Za-zá-úÁ-Ú.\s]){1,200})+$/;
var names = rtrim(value).split(' ');
var test = true;
if( names.length <= 1 ){
test = false;
}else{
for( var k=0; k< names.length; ++k ){
if( !regex.test( names[k] ) ){
test = false;