Skip to content

Instantly share code, notes, and snippets.

View esbanarango's full-sized avatar
👨‍🚀
Desayunando

Esteban esbanarango

👨‍🚀
Desayunando
View GitHub Profile
@esbanarango
esbanarango / temp findstrings.cpp
Created March 21, 2012 06:20
Interviewstreet Challenge - FIND STRINGS
using namespace std;
#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <sstream>
#include <fstream>
#include <cassert>
#include <climits>
#include <cstdlib>
@esbanarango
esbanarango / gist:2285702
Created April 2, 2012 17:55
Test for Xquery
declare namespace oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/";
declare namespace xdb="http://exist-db.org/xquery/xmldb";
declare namespace request="http://exist-db.org/xquery/request";
declare namespace dc="http://purl.org/dc/elements/1.1/";
declare namespace oai_lom="http://ltsc.ieee.org/xsd/LOM";
declare namespace functx = "http://www.functx.com";
declare function local:term-callback($term as xs:string, $data as xs:int+) as element() {
<term freq="{$data[1]}" docs="{$data[2]}" n="{$data[3]}">{$term}</term>
};
@esbanarango
esbanarango / gist:2434505
Created April 21, 2012 05:51
jQuery code on the client-side showing how Event-Driven programming works
// jQuery code on the client-side showing how Event-Driven programming works
// When a button is pressed, an Event occurs - deal with it
// directly right here in an anonymous function, where all the
// necessary variables are present and can be referenced directly
$("#myButton").click(function(){
if ($("#myTextField").val() != $(this).val())
alert("Field must match button text");
});
@esbanarango
esbanarango / gist:2456443
Created April 22, 2012 05:19
Ejemplo de un documento JSON que tiene un item de un supermercado.
{
"_id" : "bc2a41170621c326ec68382f846d5764",
"_rev" : "2612672603",
"item" : "apple",
"prices" : {
@esbanarango
esbanarango / gist:2581047
Created May 2, 2012 22:32
Tuenti, Challenge 4: 20 fast 20 furious
/*
Esteban Arango Medina
*/
#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <sstream>
#include <fstream>
#include <cassert>
@esbanarango
esbanarango / Contests schedules
Last active October 5, 2015 08:27
Url's of contests schedules... for 'Where To Train'
CODEFORCES -> http://codeforces.com/contests
TOPCODER -> http://community.topcoder.com/tc?module=Static&d1=calendar&d2=thisMonth
UVA -> http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=12 ó http://acm.uva.es/contest/
PKU -> http://poj.org/contests
SGU -> http://acm.sgu.ru/contests.php
CONTESTS ANDMEJ -> http://contests.factorcomun.org/
Z-TRENING -> http://www.z-trening.com/competitions.php
TJU -> http://acm.tju.edu.cn/toj/vcontest/
CODECHEF -> http://www.codechef.com/contests
ZOJ -> http://acm.zju.edu.cn/onlinejudge/showContests.do
@esbanarango
esbanarango / CSS ScoreReport
Created June 7, 2012 17:37
CSS Live Throw (Layout ScoreReport)
body
{
font-family: Arial, Helvetica, sans-serif;
margin: 0px;
}
.principal2
{
width: 700px;
min-height: 500px;
}
@esbanarango
esbanarango / chosen_number_of_choices.js
Created June 7, 2012 19:52
Chosen.js set the number of multiple select that you want.
º/*In this example I want the user to choose maximum 2*/
$('#id').chosen().change(function(event) {
if($(this).val()!=null){
if ($(this).val().length > 1) {
$(".chzn-drop").css("display","none");
}
if ($(this).val().length < 2) {
$(".chzn-drop").css("display","block");
}
}
@esbanarango
esbanarango / distance_calculation.sql
Created November 16, 2012 10:52
MySQL calculate distance between two latitude/longitude coordinates, assuming radius of 6,371 km
CREATE FUNCTION `lat_lng_distance` (lat1 FLOAT, lng1 FLOAT, lat2 FLOAT, lng2 FLOAT)
RETURNS FLOAT
DETERMINISTIC
BEGIN
RETURN 6371 * 2 * ASIN(SQRT(
POWER(SIN((lat1 - abs(lat2)) * pi()/180 / 2),
2) + COS(lat1 * pi()/180 ) * COS(abs(lat2) *
pi()/180) * POWER(SIN((lng1 - lng2) *
pi()/180 / 2), 2) ));
END
@esbanarango
esbanarango / README BDNG.md
Created December 2, 2012 18:40
Descripción para aplicación de búsqueda de BDNG

#BDNG

Biblioteca Digital de Nueva Generación

###Búsquedas

La aplicación de búsquedas de BDNG está compuesta por dos partes, aplicación Front-end (JavaScript) y Back-end (xQuery). Se recomienda tener conocimiento previo de xQuery para poder entender mejor la estructura y funcionamiento del Back-end.

Aquí algunos links que pueden ser de gran utilidad.