Skip to content

Instantly share code, notes, and snippets.

View pokisin's full-sized avatar
💭
programming

Wilmar P pokisin

💭
programming
View GitHub Profile
@pokisin
pokisin / route.sh
Created March 13, 2017 17:12
Rutas server
* verificar sitios en linux
nano /etc/apache2/sites-enabled/000-default.conf
@pokisin
pokisin / utils.txt
Created March 6, 2017 23:24
Utilerias Perl
------------------------------------- Para usar archivo .pm con ruta relativa ------------------------------------------------------
use FindBin qw($Bin); # /home/proyecto/scripts
use File::Basename qw(dirname); # /home/proyecto
use File::Spec::Functions qw(catdir);
use lib catdir(dirname($Bin),'reportes'); # /home/proyecto/reportes
@pokisin
pokisin / sh
Created February 28, 2017 18:20
Restringir accesos a carpetas server_ubuntu
# Primero habilitar
sudo a2enmod rewrite
# Configurar el siguiente archivo
sudo nano /etc/apache2/sites-available/000-default.conf
# Y agregar la siguiente linea al final del documento
<Directory "/var/www/html">
AllowOverride All
</Directory>
@pokisin
pokisin / mysql.md
Last active October 12, 2017 15:36
Comandos Mysql

Subconsulta update

  UPDATE dept_manager set emp_no = (select emp_no from employees limit 1) where emp_no=110039;

  UPDATE detalle_plantillas_factura dest, 
  (SELECT id_detalle_plantilla id, campo,X,Y,ancho,alto,tipo 
  FROM detalle_plantillas_factura WHERE id_plantilla_factura=102) src
  SET
    dest.campo=src.campo,
 dest.x = src.x,
@pokisin
pokisin / git.txt
Last active January 5, 2017 17:46
error git the server's rsa2 key fingerprint
"C:\Program Files (x86)\Atlassian\SourceTree\tools\putty\plink.exe" -ssh user@bitbucket.org
@pokisin
pokisin / post_get.js
Last active January 5, 2017 17:47
Peticiones post,get con Jquery
------------------------------- POST -------------------------------
$.post(ruta,{ids:ids_movimientos},function(data, status, jqXHR){
console.log(data);
console.log("status: "+status);
console.log(jqXHR);
},"json").fail(function(e) {
alert( e.responseText );
});
------------------------------- GET -------------------------------
@pokisin
pokisin / obtiene_datos_fila.js
Last active January 5, 2017 17:48
Recuperar las filas seleccionadas en jqxGrid
function getALLROWSselected(id_grid){
var rowindexes = $('#'+id_grid).jqxGrid('getselectedrowindexes');
var allRow = new Array();
for (var i = 0; i < rowindexes.length; i++) {
var datarow = $('#'+id_grid).jqxGrid('getrowdata', rowindexes[i]);
allRow.push(datarow);
}
return allRow;
}
@pokisin
pokisin / jquery_eventos.js
Last active January 5, 2017 17:48
Eventos con Jquery - Como crear un listener y como lanzar respuesta
// Crea el evento para escuchar
$( "#id_ejemplo" ).on( "valido", function( event, mnsg ) {
console.log(mnsg);
});
En otro archivo ó en el mismo despachas el evento
$( "#id_ejemplo" ).trigger( "valido", "ya termino de subir el archivo" );
@pokisin
pokisin / parametro_funcion.PHP
Last active July 29, 2018 23:14
Pasar una función como parámetro en PHP
public function test(){
$vector = ["hola", "como", "estan"];
$this->test2($vector, function(){
echo "soy un mensaje desde la funcion";
},"el mensaje de arriba es el chido");
}
public function test2($arr, $response, $mensaje){
print_r($arr);
$response();
@pokisin
pokisin / call.js
Last active January 5, 2017 17:46
Callbacks Javascript
function basic( callback ){
console.log( 'do something here' );
var result = 'i am the result of `do something` to be past to the callback';
// if callback exist execute it
callback && callback( result );
}
function callbacks_with_call( arg1, arg2, callback ){