Skip to content

Instantly share code, notes, and snippets.

@csalgueiro
csalgueiro / .htaccess
Created October 4, 2013 08:47 — forked from jgdoncel/.htaccess
Cambiar el Huso horario a UTC
php_value date.timezone UTC
@csalgueiro
csalgueiro / ejemplo_01.sql
Created October 4, 2013 08:48 — forked from jgdoncel/ejemplo_01.sql
Añadir un campo numerado a una consulta
# La siguiente consulta añade un campo numerado a una consulta:
set @num=0;
select id, @num:=@num+1 AS contando FROM tabla;
@csalgueiro
csalgueiro / gist:6822944
Created October 4, 2013 08:49 — forked from jgdoncel/gist:2635022
ON DUPLICATE KEY UPDATE
INSERT INTO clientes_peticiones (
id_cliente,fecha,peticiones
) VALUES (
1,'2011-11-02',1
) ON DUPLICATE KEY UPDATE peticiones = peticiones+1;
@csalgueiro
csalgueiro / errors.php
Created October 4, 2013 08:53
PHP Display all errors
error_reporting(E_ALL);
ini_set('display_errors', '1');
@csalgueiro
csalgueiro / nuevo_xml.php
Created October 4, 2013 10:38
XML via DomDocument
$dom = new DOMDocument("1.0","utf-8");
$elemento = $dom->createElement("elemento");
$dom->appendChild($elemento);
$xml = $dom->saveXML();
@csalgueiro
csalgueiro / addons.css
Created October 4, 2013 10:45
Elipsis de textos
.text_ellipsis{
white-space: nowrap;
text-overflow: ellipsis;
overflow-x: hidden;
display: block;
}
@csalgueiro
csalgueiro / datatablesfootercallback.js
Created October 8, 2013 06:49
Sumar Totales de un Datable (siempre y cuando haya texto en el th equivalente de la anterior fila)
"fnFooterCallback": function ( nRow, aaData, iStart, iEnd, aiDisplay ) {
var total = [];
if(aaData.length>0){
for ( var i=0 ; i<aaData.length ; i++ ){
for ( var j=1 ; j<aaData[i].length; j++ ){
if(aaData[i][j]!="undefined" && aaData[i][j]!=null){
total[j] = (parseFloat(total[j]) || 0) + parseFloat(aaData[i][j]);
}
}
}
@csalgueiro
csalgueiro / custom_validate.js
Created October 8, 2013 11:35
Add Custom Validation
$("#"+formid).find("input[name^='losqempiecenpor']").each(function () {
var $element = $(this);
$element.rules('add', { required: true, maxlength:30 });
});
@csalgueiro
csalgueiro / animation.css
Created October 8, 2013 12:17
CrossBrowser easy CSS3 animation
.objeto_animado{
-webkit-animation-name: escala;
-webkit-animation-duration: 0.6s;
-webkit-animation-iteration-count:1;
-ms-animation-name: escala;
-ms-animation-duration: 0.6s;
-ms-animation-iteration-count:1;
-moz-animation-name: escala;
-moz-animation-duration: 0.6s;
-moz-animation-iteration-count:1;
@csalgueiro
csalgueiro / capitalize.sql
Created October 16, 2013 15:33
Capitaliza palabras en SQL
CREATE FUNCTION CAP_FIRST (input VARCHAR(255))
RETURNS VARCHAR(255)
DETERMINISTIC
BEGIN
DECLARE len INT;
DECLARE i INT;