Skip to content

Instantly share code, notes, and snippets.

View Jamp's full-sized avatar

Jaro Marval Jamp

View GitHub Profile
@Jamp
Jamp / gist:7ca12b7d5a881e0ec35b64935003b7da
Created September 20, 2016 19:31
ListView grow with items
int totalHeight = 0;
for (int i = 0; i < adapter.getCount(); i++) {
View listItem = adapter.getView(i, null, listView);
listItem.measure(0, 0);
totalHeight += listItem.getMeasuredHeight();
}
ViewGroup.LayoutParams params = listView.getLayoutParams();
params.height = 200 * (arrayData.size() + 1);
@Jamp
Jamp / url
Created October 28, 2016 15:44
Url Servidor motivate
https://mega.nz/#!9g5BwCzY!jMV9Kng8xgsQ-gy60PY3xuJfy0G_OxLGF7nJZq93Rfw
@Jamp
Jamp / startVM.bat
Created October 28, 2016 16:04
Iniciar VMs de Virtualbox en Windows
“C:\Program Files\Oracle\VirtualBox\VBoxManage.exe” setextradata “EXAMPLE VM” GUI/Seamless on
“C:\Program Files\Oracle\VirtualBox\VBoxManage.exe” startvm “EXAMPLE VM” -type GUI
@Jamp
Jamp / index.html
Created November 18, 2016 18:53
Solución al ejercicio de geolocalización
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Geolocalización</title>
<script type="text/javascript" src="zepto.min.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script type="text/javascript" src="gmaps.js"></script>
<link rel="stylesheet" type="text/css" href="mapa.css" />
<script type="text/javascript">
@Jamp
Jamp / functions.php
Created March 8, 2017 03:42
Eliminar problemas con diferentes versiones de jQuery en Wordpress
<?php
// Eliminar cualquier jQuery para solo usar el del tema
function resolve_conflict_jquery() {
wp_deregister_script('jquery');
wp_register_script('jquery', get_template_directory_uri() . '/js/jquery.min.js', false, null, true);
wp_enqueue_script('jquery');
}
add_action('wp_enqueue_scripts', 'resolve_conflict_jquery');
?>
@Jamp
Jamp / example.js
Created March 22, 2017 13:19
Validar caducidad del sessionStorage
/**
* load the content via AJAX,
* and attempt to cache in sessionStorage
*/
(function() {
var hasStorage = ("sessionStorage" in window && window.sessionStorage),
storageKey = "yourUniqueStorageKey",
now, expiration, data = false;
@Jamp
Jamp / build_mysql.sh
Last active November 14, 2023 17:19 — forked from shichao-an/build_mysql.sh
Build and install MySQL 5.1 from source on Ubuntu 16.04
#!/bin/bash
# Run as root
set -e
apt-get update
apt-get install -y build-essential
apt-get install -y libncurses5-dev
useradd mysql
@Jamp
Jamp / script_backup.sh
Last active May 12, 2017 19:48
Backup one to one database with check
#!/bin/bash
#
# For create user `GRANT LOCK TABLES, SELECT ON DATABASE.* TO 'BACKUPUSER'@'%' IDENTIFIED BY 'PASSWORD';`
#
#### MySQL CREDENTIAL ###
HOST='localhost'
USER='root'
@Jamp
Jamp / www.conf
Created June 19, 2017 15:04
Configuración para mejorar el uso de recursos de PHP-FPM
pm = ondemand
pm.max_children = 75
pm.start_servers = 10
pm.min_spare_servers = 5
pm.max_spare_servers = 20
pm.process_idle_timeout = 10s
pm.max_requests = 500
@Jamp
Jamp / project_django.conf
Created June 24, 2017 23:27
Nginx for Django
upstream django_app_server {
server unix:/var/webapps/django/api.sock fail_timeout=0;
}
server {
listen 80;
server_name _;
client_max_body_size 4G;