Skip to content

Instantly share code, notes, and snippets.

@eislasq
eislasq / store.js
Created November 12, 2020 21:25
Auto Load More elements on WP Shopify
jQuery(document).ready(function( $ ){
function checkIfInView(element){
var offset = element.offset().top - $(window).scrollTop();
if(offset > window.innerHeight){
// Not in view so scroll to it
//$('html,body').animate({scrollTop: offset}, 1000);
return false;
}
return true;
@eislasq
eislasq / Json2Xml.php
Created April 3, 2018 15:20
Convierte un objeto json en xml con el noro raiz cfdi:Comprobante
<?php
/**
* Description of Json2Xml
*
* @author eislas
*/
class Json2Xml {
/**
*
@eislasq
eislasq / activate.sql
Created February 23, 2017 19:22
Plugin wordpress
CREATE TABLE if not exists empleo_test (blob_col BLOB, INDEX(blob_col(10)));
@eislasq
eislasq / redeemCodes.sh
Last active December 1, 2016 18:59
Redeem multiple ingress codes
#!/bin/bash
#Redime un codigo cada 5 a 10 segundos de una lista en un archivo de texto
#Recomiendo no redimir mas de 30 codigos seguidos para que no les ballan a bloquear la cuenta
#Y estar al tanto de la salida para detener el script si se calienta
#en ese caso mostrará un mensaje como este "Passcode circuitry too hot. Wait for cool down to enter another passcode."
if [ "$1" != "" ]; then
echo "Procesando codigos del archivo $1"
else
echo "proporciona un archivo con códigos, Ej. #sh redeemCodes.sh codes.txt"
@eislasq
eislasq / angular_service_to_send_requests_php.js
Last active May 12, 2016 20:55
Ejemplo para subir un archivo con angular, usa https://gist.github.com/eislasq/dddae2e1cdd8d21a7ffc para las directivas drag&drop. De lo contrario usa <input onchange="angular.element(this).scope().fileSelected(event, this)" para disparar el evento al seleccionar archivo
/**
* @example
* to use in controller you ned insert WS service:
* <example>
* ...
* .controller('YourCtrl', function ($scope, WS) {
* var request = WS.uploadFile('Template', 'upload', {template: templateName}, file);
* request.then(...
* ...
* </example>
<?php
/**
* Description of CfdiObject
* Crea un objeto a partir de un XML de CFDI par su facil manejor en php como objeto
*
* @author eislas
* @param $element String|DOMElement XMLfile path or a dom_import_simplexml(simplexml_load_file(XML_PATH_FILE)) result object.
* @use $cfdiObject = new CfdiObject($element);
*/
class CfdiObject {
@eislasq
eislasq / Validar_CFDI_en_SAT.php
Last active June 17, 2016 20:38
Facturacion electronica php y openssl
<?php
$client = new SoapClient("https://consultaqr.facturaelectronica.sat.gob.mx/ConsultaCFDIService.svc?wsdl");
$result = $client->__soapCall('Consulta', array(array('expresionImpresa' => '?re=' . filter_input(INPUT_GET, 're') . '&rr=' . filter_input(INPUT_GET, 'rr') . '&tt=' . filter_input(INPUT_GET, 'tt') . '&id=' . filter_input(INPUT_GET, 'id'))));
var_dump($result);
<?php
/**
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of

PHP

print_r(print<Tab>)

echo "<pre><div class='hgPrintR' style='border:1px solid blue;'>";
print_r(${VARIABLE variableFromPreviousAssignment default="$_POST"}${cursor});
echo "</div></pre>";

var_dump(var<Tab>)

@eislasq
eislasq / DragAndDropDirectives.js
Last active May 12, 2016 19:20
Angular directives for html5 drag and drop
/*
* This is a copy of ng-click directive and modified to handle Drag and Drop events
*/
/**
* @ngdoc directive
* @name ngDragover
*
* @description
* The `ngDragover` directive allows you to specify custom behavior on a dragover event.
*