Skip to content

Instantly share code, notes, and snippets.

@henocdz
henocdz / tooltipster-dynamic-color.js
Last active August 11, 2017 07:09
Tooltipster dynamic color on hover
$('.tooltip').tooltipster({
functionBefore: function(origin, continueTooltip){
continueTooltip();
var color = origin.data('color');
if(!color){ return false; }
$('.tooltipster-default').css({
'background-color': color
});
@henocdz
henocdz / query.java
Last active August 29, 2015 14:09
Android+Parse GeoSpatial Query
//Assuming that you have "Google Play Services" configured
//protected LocationClient mLocationClient;
//mLocationClient = new LocationClient(this, this, this);
// protected Location mLocation;
float DISTANCE = 0.2;
mLocation = mLocationClient.getLastLocation();
ParseQuery<ParseObject> places = ParseQuery.getQuery("AParseClass");
Log.i(LOG_TAG, mLocation.toString());
places.whereWithinKilometers("location", new ParseGeoPoint(mLocation.getLatitude(), mLocation.getLongitude()), DISTANCE);
@henocdz
henocdz / kardex.js
Last active August 29, 2015 14:15
Obtener promedio general de la carrera. Kardex - Institupo Politecnico Nacional
//Obtener promedio general de la carrera. Kardex - Institupo Politecnico Nacional
$(function(){
var kardex = {}
var container = $('#ctl00_mainCopy_Panel1');
var tables = container.find('table');
tables.each(function(i, table){
// console.log('table', el);
var tbody = $(table).find('tbody');
@henocdz
henocdz / algo.py
Last active August 29, 2015 14:19
Introducción a Python 2.7 - 4devs
#Se modificó para importar desde un archivo
from archivo import haz_algo as ha
def haz_algo():
return 'desde haz algo'
print 'Suma algo: '
print haz_algo
print ha(4, 5)
@henocdz
henocdz / Sensei.java
Last active August 29, 2015 14:24
DevF Batch 5 Example for Encapsulation Exercise
// File: devf/Sensei.java
package devf;
import java.util.HashMap;
public class Sensei{
private String type, firstName, lastName;
private static HashMap<String, Double> types;
private static double taxPercentage = 0.16;
; supervisor config file
[inet_http_server]
port=127.0.0.1:9001
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP)
#!/bin/bash
NAME="project_name"
DJANGODIR="/path/to/django_project"
VIRTUAL_ENV_DIR="/path/to/virtualenv/folder"
VIRTUAL_ENV_FILE=${DJANGODIR}/.env
# SOCKFILE=
ADDRESS=0.0.0.0:8000
USER=sysuser
user nginx;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
upstream backend_staging {
server SOME_IP:PORT weight=5 max_fails=3 fail_timeout=30s;
}
server {
listen 80;
server_name www.domain.com;
return 301 http://$server_name$request_uri;
}
server {
@henocdz
henocdz / paramiko_invoke_server.py
Created October 8, 2015 04:06
Connect to a given hostname in a given SSH config file (Invoke + Paramiko)
"""
Used with Invoke to automate tasks
Connect to a given hostname in a given SSH config file
Inpired by: https://gist.github.com/acdha/6064215
"""
from invoke import task, run
from paramiko import SSHConfig, SSHClient, SSHException, AutoAddPolicy
import logging