Skip to content

Instantly share code, notes, and snippets.

View EliuTimana's full-sized avatar
🚲
Working from home

Eliú Timaná EliuTimana

🚲
Working from home
View GitHub Profile
@EliuTimana
EliuTimana / jqPlot-Horizotal.js
Last active September 13, 2015 02:12
JpPlot Horizonal Bar Chart
jQuery.jqplot.config.enablePlugins = true;
jQuery.jqplot('grafico', [data],{
animate: true,
seriesDefaults: {
renderer: jQuery.jqplot.BarRenderer,
pointLabels: {
show: true
},
rendererOptions:{
barDirection: 'horizontal'
<?php
function thumbnail($path){
list($ancho, $alto) = getimagesize($path);
$nuevo_ancho = $nuevo_alto = 150;
$ext = '.'.pathinfo($path, PATHINFO_EXTENSION);
$name = pathinfo($path, PATHINFO_FILENAME);
$dir = pathinfo($path, PATHINFO_DIRNAME);
$thumb = imagecreatetruecolor($nuevo_ancho, $nuevo_alto);
@EliuTimana
EliuTimana / jquery.mobile.full.height.scss
Created September 15, 2015 22:01
jQuery Mobile | Full Height Content
.ui-page{
height: 100%;
.ui-content{
min-height: 100%;
}
}
DELIMITER $$
CREATE PROCEDURE sp_fail()
BEGIN
DECLARE _rollback BOOL DEFAULT 0;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET _rollback = 1;
START TRANSACTION;
INSERT INTO tablea (date) VALUES (NOW());
INSERT INTO tableb (date) VALUES (NOW());
INSERT INTO tablec (date) VALUES (NOW()); -- FAIL
IF _rollback THEN
@EliuTimana
EliuTimana / valida_RUC.php
Last active October 24, 2015 19:17
Implementación del algoritmo para validación de formato de RUC en PHP | SUNAT Perú
<?php
public function validaRucAction(array $ruc){
$values = array(5,4,3,2,7,6,5,4,3,2,0);
$sum = 0;
$valido = false;
for($i = 0; $i < strlen($ruc[0]); $i++){
$sum += intval($ruc[0][$i]) * intval($values[$i]);
}
.image {
position: absolute;
top: 50%;
left: 50%;
width: 120px;
height: 120px;
margin:-60px 0 0 -60px;
-webkit-animation:spin 1s linear infinite;
-moz-animation:spin 1s linear infinite;
animation:spin 1s linear infinite;
@EliuTimana
EliuTimana / date_y_m_d.php
Created October 7, 2016 00:47
day/month/year to year-month-day in PHP
<?php
// 27/5/2016
$fecha = str_replace('/','-', '27/05/2016'); // String -> 27-05-2016
$fecha = strtotime($fecha); //1464332400
$fecha = date('Y-m-d',$fecha); //String -> 2016-05-27
$fecha = date_create($fecha); //2016-05-27 00:00:00.000000
127.0.0.1 mc.corel.com
127.0.0.1 apps.corel.com
// carrito.html
$(document).on('click', '#btnConfirmar', function () {
if (localStorage.id_usuario) {
$.post('../sys/ws/pedido.php', {
op:'confirma_cart',
id_pedido: localStorage.id_pedido
}, function (response) {
localStorage.removeItem("id_pedido");
InstantClick.go('index.html');
});
@EliuTimana
EliuTimana / document_types.rb
Created December 29, 2017 05:12 — forked from acuppy/document_types.rb
All major document mime types (Microsoft Office, Apple iWork, Adobe PDF) as a Ruby Module
module DocumentFileTypes
module Microsoft
WORD = %w(
application/msword
application/vnd.openxmlformats-officedocument.wordprocessingml.document
application/vnd.openxmlformats-officedocument.wordprocessingml.template
application/vnd.ms-word.document.macroEnabled.12
application/vnd.ms-word.template.macroEnabled.12
)