Skip to content

Instantly share code, notes, and snippets.

View andresamayadiaz's full-sized avatar

Andrés Amaya Díaz andresamayadiaz

View GitHub Profile
// ALMACEN/ROOT: 0=codigo, 1=nombre, 2=direccion, 3=telefono, 4=email, 5=persona de contacto
// ITEMS: id de categoria, nombre de categoria, codigo, unidades de medida, nombre, descripcion, almacen, existencias, precio
{
"0": "LZC2",
"1": "LZC2",
"2": "AV. LOS COCOS NO. 25 PB\nCOL. 3ER SECTOR DE FIDEICOMISO\nLAZARO CARDENAS, MICHOACAN",
"3": "7535376196",
"4": "joyacerolzc2@gmail.com",
"5": "",
@andresamayadiaz
andresamayadiaz / install.sh
Created March 15, 2017 22:22
Installs LAMP with PHP 5.6 on Ubuntu 16.04
#!/bin/bash
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y apache2
sudo ufw allow in "Apache Full"
sudo apt-get install -y mysql-server
# After running this command, select (Y), option 2, then (Y) for the rest of the prompts.
sudo mysql_secure_installation
<?php
error_reporting(0);
@ini_set('display_errors', 0);
@ini_set('max_execution_time', 300);
@set_time_limit(0);
class CacheAPC {
var $iTtl = 600;
var $bEnabled = false;
// Tacit, Wrist mounted tactile feedback for the blind.
// By Steve Hoefer at Grathio Labs (http://grathio.com)
// Version 12.02.04
//
// Copyright (c) 2012 Steve Hoefer
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
// associated documentation files (the "Software"), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
@andresamayadiaz
andresamayadiaz / gist:4617778
Created January 24, 2013 04:57
Test Validation
def validate
# open("http://www.sat.gob.mx/cfd/3/cfdv32.xsd")
doc = Nokogiri::XML( File.read("/Users/andresamayadiaz/Documents/rails/receptorcfd/public/comp32.xml"), nil, "UTF-8", Nokogiri::XML::ParseOptions::RECOVER )
#puts "KEYS: " + doc.root.keys.to_s
#puts "Schema: " + doc.root["xsi:schemaLocation"]
schemata_by_ns = Hash[ doc.root["xsi:schemaLocation"].scan(/(\S+)\s+(\S+)/) ]
schemata_by_ns.each do |ns,xsd_uri|
<?xml version="1.0" encoding="UTF-8"?>
<cfdi:Comprobante xmlns:cfdi="http://www.sat.gob.mx/cfd/3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bfa2="http://www.buzonfiscal.com/ns/addenda/bf/2" xmlns:tfd="http://www.sat.gob.mx/TimbreFiscalDigital" LugarExpedicion="SAN PEDRO GARZA GARCIA Nuevo León" metodoDePago="No identificado" tipoDeComprobante="ingreso" total="1357.20" Moneda="MXN" TipoCambio="1" descuento="0.00" subTotal="1170.00" certificado="MIIEoTCCA4mgAwIBAgIUMDAwMDEwMDAwMDAyMDA0MjgzNDMwDQYJKoZIhvcNAQEFBQAwggGVMTgwNgYDVQQDDC9BLkMuIGRlbCBTZXJ2aWNpbyBkZSBBZG1pbmlzdHJhY2nDs24gVHJpYnV0YXJpYTEvMC0GA1UECgwmU2VydmljaW8gZGUgQWRtaW5pc3RyYWNpw7NuIFRyaWJ1dGFyaWExODA2BgNVBAsML0FkbWluaXN0cmFjacOzbiBkZSBTZWd1cmlkYWQgZGUgbGEgSW5mb3JtYWNpw7NuMSEwHwYJKoZIhvcNAQkBFhJhc2lzbmV0QHNhdC5nb2IubXgxJjAkBgNVBAkMHUF2LiBIaWRhbGdvIDc3LCBDb2wuIEd1ZXJyZXJvMQ4wDAYDVQQRDAUwNjMwMDELMAkGA1UEBhMCTVgxGTAXBgNVBAgMEERpc3RyaXRvIEZlZGVyYWwxFDASBgNVBAcMC0N1YXVodMOpbW9jMRUwEwYDVQQtEwxTQVQ5NzA3MDFOTjMxPjA8BgkqhkiG9w0BCQIML1Jlc3Bvb
@andresamayadiaz
andresamayadiaz / gist:2149578
Created March 21, 2012 17:05
init.d script to launch Play framework under CentOS/RedHat
#!/bin/bash
# chkconfig: 345 20 80
# description: Play start/shutdown script
# processname: play
#
# Instalation:
# copy file to /etc/init.d
# chmod +x /etc/init.d/play
# chkconfig --add /etc/init.d/play
# chkconfig play on
@andresamayadiaz
andresamayadiaz / Users
Created January 28, 2012 03:41
Play Password Change
public static void update(User entity, String repassword, boolean chgPassword) {
Gson gson = new Gson();
Logger.info("ENTITY 1: "+gson.toJson(entity));
// Validate Password Change
if(chgPassword){
if(!entity.password.equals(repassword)){
@andresamayadiaz
andresamayadiaz / playframework
Created January 9, 2012 19:03 — forked from domdorn/playframework
Upstart Script for the PlayFramework 1.x
# Upstart script for a play application that binds to an unprivileged user.
# put this into a file like /etc/init/playframework
# you can then start/stop it using either initctl or start/stop/restart
# e.g.
# start playframework
# http://dominikdorn.com
description "Description of your app"
author "Dominik Dorn <dominik@studyguru.eu>"
version "1.0"
@andresamayadiaz
andresamayadiaz / gist:1287342
Created October 14, 2011 14:57 — forked from ffub/gist:1084424
Balsamiq HTML export
#!/usr/bin/php
<?php
error_reporting(E_ALL);
if (count($argv) <= 1) {
print("usage createMockup src_dir dst_dir images_dir\n");
print("\tsrc_dir : dir where all bmml file are\n");
print("\tdst_dir : dir where write all html files\n");
print("\timages_dir : dir where all export mockup png are (will be copied to the \$dst_dir/images directory)\n");
exit(1);
}