Skip to content

Instantly share code, notes, and snippets.

View somoza's full-sized avatar
🔮
Preparing Elixir

Julián Somoza somoza

🔮
Preparing Elixir
View GitHub Profile
@somoza
somoza / .php
Created July 8, 2018 23:13
Filtro por fecha Desde y Hasta Symfony 1.4
$this->widgetSchema['membership_start'] = new sfWidgetFormFilterDate(
array(
'from_date' => new sfWidgetFormJQueryDate(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%'))
)),
'to_date' => new sfWidgetFormJQueryDate(array(
function CallAPI($method, $url, $data = false)
{
$curl = curl_init();
switch ($method)
{
case "POST":
curl_setopt($curl, CURLOPT_POST, 1);
if ($data)
@somoza
somoza / databases.yml
Created June 10, 2018 21:46 — forked from serapheem/databases.yml
Symfony - SQLite database connection
test:
doctrine:
param:
dsn: 'sqlite::memory:'
# dsn: 'mysql:host=localhost;dbname=clipkit_dev'
# dsn: 'sqlite:%SF_DATA_DIR%/test-doctrine.db'
statistic:
param:
dsn: 'sqlite::memory:'
tracking:
@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 <[email protected]>
* @author Krzysztof Kotowicz <kkotowicz at gmail dot com>
* @author Gadfly <[email protected]>
function rounddowntohundred($theNumber) {
if (strlen($theNumber)<3) {
$theNumber=$theNumber;
} else {
$theNumber=substr($theNumber, 0, strlen($theNumber)-2) . "00";
}
return $theNumber;
}
@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);
@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 / 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 / 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 / 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