Skip to content

Instantly share code, notes, and snippets.

@enlacee
enlacee / php-xml
Created February 8, 2013 23:30
Generar XML para almacenar en una base de datos relacional
<?php
$xml = new DOMDocument('1.0','UTF-8');
$lms = $xml->createElement('data');
$xml->appendChild($lms);
//id
$id = $xml->createElement('id','6699');
$lms->appendChild($id);
@enlacee
enlacee / ae_googleMap.php
Last active December 14, 2015 01:39
Script PHP para obtener : -latitud -longitud usando GoogleMap Full. +sql -cortesia freeway.
<?php
ini_set('max_execution_time', 600); //300 seconds = 5 minutes
function getData(){
$pdo = new PDO("mysql:host=localhost;dbname=anb_wordpress", "root", "",
array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
$query = "SELECT *FROM wp_master_office WHERE status != 1;";
$pdo->beginTransaction();
$stm = $pdo->prepare($query);
<script type="text/javascript"
src="http://maps.googleapis.com/maps/api/js?key=AIzaSyCJHoCLJb_K0TPxWagrigvltvi33-lhpDU&sensor=false">
</script>
<script type ="text/javascript">
function initialize() {
// marcas padre
var mapOptions = {
zoom: 6,
@enlacee
enlacee / solo_numeroJS
Created February 22, 2013 22:14
Solo numeros en Firefox and IExplorer
<html>
<script type="text/javascript">
var nav4 = window.Event ? true : false;
function IsNumber(event){
// Backspace = 8, Enter = 13, ’0′ = 48, ’9′ = 57, ‘.’ = 46
var key = nav4 ? event.which : event.keyCode;
return (key <= 13 || (key >= 48 && key <= 57) || key == 46);
}
</script>
<body>
@enlacee
enlacee / googleMapMultiEvent.js
Created February 22, 2013 23:38
mapa full event click == una function anonima compleja. windows.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1. Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv='Content-type' content='text/html;charset=UTF-8' />
<title>Freeway</title>
<!-- SCRIPT MAPA -->
<style type="text/css">
#map_canvas { height: 100% }
</style>
<script type="text/javascript"
@enlacee
enlacee / apunte.git
Last active December 24, 2015 21:49
apuntes git en Desarrollo.
-- Retorna al commit #xxx : pero con tu HEAD intacto
git revert HASH
-- Retornar ah 1 comit anterior (resetea tambien tu HEAD)
git reset --hard HASH
-- diferencias entre ramas
git difftool dev2b master
@enlacee
enlacee / mysql.sub
Created October 7, 2013 21:12
sub consulta mysql
SELECT
maa.idmarca,
maa.nombremarca,
(SELECT COUNT(*) FROM npc_detallebusqueda db
INNER JOIN npc_versionAutoEnte vae ON db.idauto = vae.idauto
INNER JOIN npc_version ve ON vae.idversion = ve.idversion
INNER JOIN npc_marca AS ma ON db.IdMarcaDetalleBusqueda = ma.idmarca
INNER JOIN npc_tipoauto AS t ON t.idtipoauto = db.IdTipoAutoDetalleBusqueda
WHERE (t.idTipoVehiculo = 1)
AND (ve.flagActivo = 1)
@enlacee
enlacee / jquery.js
Last active December 27, 2015 01:09
-- seleccionar combo.
$('#tipoVehiculo1 option').eq(0).attr("selected", "selected");
-- seleccionar text y hidden.
$('#captchas[type="hidden"]').val()
$('#captchas[type="text"]').val(),
$('body').on('DOMMouseScroll mousewheel', function (e) {
if(e.originalEvent.detail > 0 || e.originalEvent.wheelDelta < 0) { //alternative options for wheelData: wheelDeltaX & wheelDeltaY
//scroll down
console.log('Down');
} else {
//scroll up
console.log('Up');
}
//prevent page fom scrolling
return false;
@enlacee
enlacee / php.php
Last active December 29, 2015 03:09
<?php
// -- leer archivo
echo file_get_contents(__FILE__);
$fp = fopen('data.txt', 'w');
fwrite($fp, '123');
fclose($fp);