Skip to content

Instantly share code, notes, and snippets.

View somoza's full-sized avatar
🎯
Focusing

Julián Somoza somoza

🎯
Focusing
  • Argentina
  • 09:32 (UTC -03:00)
View GitHub Profile
@somoza
somoza / NestedSet, Categorias anidadas...
Created August 16, 2013 21:07
NestedSet, Categorias anidadas...
Ponemos el Behaivor:
Category:
actAs:
Timestampable: ~
NestedSet:
hasManyRoots: true
rootColumnName: root_id
columns:
name: { type: string(100) }
@somoza
somoza / content type
Last active October 1, 2017 23:22
Symfony 1.4 - Content Type en el action
$this->getResponse()->setContentType('application/rss+xml');
@somoza
somoza / iconos admin generator
Created August 16, 2013 21:09
Iconos en el admin generator
Elegir el icono en http://jqueryui.com/themeroller/
Si por ejemplo quiero el ui-icon-document
En el generator poner: ui-icon: document
actions:
_new: ~
export:
label: Exportar
action: export
ui-icon: document
@somoza
somoza / chained
Last active October 1, 2017 23:22
Symfony 1.4 - Dropdown encadenados o chained combobox en admin generator jroller
El plugin es el jquery chained, esta en propos (productos) y en b2000 (articulos)
Necesitamos del cache los archivos:
_form_fieldset
_form_field
_form
editSuccess
newSuccess
Entre los partial se van pasando el collection para armar el dropdown, empezando de newSuccess o editSuccess hacia _form->_form_fieldset->_form_field
@somoza
somoza / pdf plugin
Created August 16, 2013 21:11
PDF Plugin
./symfony plugin:install SfTCPDFPlugin
IMPORTANTE: Copiar clase de la libreria de plugins/sfTCPDFPlugin/lib copiar de proyecto existente (camara o bariloche).
LOGO del PDF: Esta dentro de /plugins/sfTCPDFPlugin/lib/tcpdf/images/logo.png
Archivo: apps/backend/config/pdf_configs.yml
Snipet:
$newPdf = $this->createPdf($this->getPartial('report', array(
'previusCc'=>$this->previusCc,
'ccEntrySubtotal'=>$this->ccEntrySubtotal,
'date'=>$this->date,
'arrEntries'=>$this->arrEntries,
@somoza
somoza / sfWidgetFormInputFileEditable
Last active October 1, 2017 23:21
Symfony 1.4 - sfWidgetFormInputFileEditable con todas las opciones....
//NO IMAGEN
$this->widgetSchema['mp3'] = new sfWidgetFormInputFileEditable(
array(
"edit_mode" => true,
"file_src" => '/uploads/mp3/'.$this->getObject()->getMp3(),
"is_image" => false,
"with_delete" => true,
'delete_label' => 'Eliminar MP3'
));
@somoza
somoza / grok-patterns
Last active August 31, 2015 17:57 — forked from mesimeris/grok-patterns
LOGSTASH: syslog listener filtering with grok patterns and applying useful tags
# NOTE: These patterns take into account the additional log-line information passed to the logstash listener from rsyslog. YMMV.
DHCPD ((%{SYSLOGTIMESTAMP:timestamp})\s*(%{HOSTNAME:hostname})\s*dhcpd\S+\s*(%{WORD:dhcp_action})?.*[for|on] (%{IPV4:dhcp_client_ip})?.*[from|to] (%{COMMONMAC:dhcp_client_mac})?.*via (%{USERNAME:interface}))
IPTABLES ((%{SYSLOGTIMESTAMP:nf_timestamp})\s*(%{HOSTNAME:nf_host})\s*kernel\S+\s*(%{WORD:nf_action})?.*IN=(%{USERNAME:nf_in_interface})?.*OUT=(%{USERNAME:nf_out_interface})?.*MAC=(%{COMMONMAC:nf_dst_mac}):(%{COMMONMAC:nf_src_mac})?.*SRC=(%{IPV4:nf_src_ip}).*DST=(%{IPV4:nf_dst_ip}).*PROTO=(%{WORD:nf_protocol}).?*SPT=(%{INT:nf_src_port}?.*DPT=%{INT:nf_dst_port}?.*))
DNS ((%{MONTHDAY:day})-(%{MONTH:month})-(%{YEAR:year}) (%{TIME:timestamp}) client (%{IPV4:dns_client_ip})#(%{NONNEGINT:dns_uuid})?.*query: (%{HOSTNAME:dns_dest}) (%{WORD:dns_type}) (%{WORD:dns_record})?.*(%{IPV4:dns_server}))
PGSQL ((%{SYSLOGTIMESTAMP:pgsql_timestamp}) (%{HOSTNAME:pgsql_hostname})?.*SAST >(%{WORD:pgs
@somoza
somoza / new_gist_file.php
Last active October 1, 2017 23:21
Symfony 1.4 - DatePicker
$widgetFormSettings = array(
'config' => '{}',
'culture' => 'es',
'config' => "{firstDay: 1, dayNamesMin: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa'], monthNames: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre']}",
'date_widget' => new sfWidgetFormDate(array('format' => '%day%-%month%-%year%', 'years' => array_combine(range(2013, 2020), range(2013, 2020)))),
'image' => '/images/calendar.png'
);
$this->widgetSchema['published_at'] = new sfWidgetFormJQueryDate($widgetFormSettings);
function rounddowntohundred($theNumber) {
if (strlen($theNumber)<3) {
$theNumber=$theNumber;
} else {
$theNumber=substr($theNumber, 0, strlen($theNumber)-2) . "00";
}
return $theNumber;
}
@somoza
somoza / ahBaseFormDoctrine
Created May 27, 2018 23:14
Modificación para i18n
<?php
/**
* Doctrine form base class that makes it pretty easy to embed one or multiple related forms including creation forms.
*
* @package ahDoctrineEasyEmbeddedRelationsPlugin
* @subpackage form
* @author Daniel Lohse <info@asaphosting.de>
* @author Krzysztof Kotowicz <kkotowicz at gmail dot com>
* @author Gadfly <gadfly@linux-coders.org>