Skip to content

Instantly share code, notes, and snippets.

View hminaya's full-sized avatar
🎯
Focusing

Hector Minaya hminaya

🎯
Focusing
View GitHub Profile
// Busca los posts relacionados
function BuscarRelacionados(pstTag){
pstTag = $.trim(pstTag);
if(pstTag){
$.getScript("http://developers.do/api/read/json?tagged=" + pstTag, function(){
// Crea el header el LI
$("<span style='font-weight: bold;' id='spn" + pstTag + "'>" + pstTag + "</span><ul id='" + pstTag+ "'></ul><br>").appendTo("#PostsRelacionados");
@hminaya
hminaya / social buttons
Created March 12, 2013 22:48
social buttons
<div class="row-fluid" style="vertical-align: top;text-align: center;">
<a href="https://twitter.com/share?via=vacantesrd&text=Conoce a http://www.emplea.do, un job board dedicado al sector de tecnología de la información en la República Dominicana. " class="twitter-share-button" data-lang="en">Tweet</a>
<div class="fb-like" data-send="false" data-layout="button_count" data-width="450" data-show-faces="false"></div>
<g:plusone></g:plusone>
<script type="IN/Share" data-counter="right"></script>
</div>
@hminaya
hminaya / json-api-ruby.rb
Last active December 16, 2015 05:18
get JSON api with ruby
require "net/http"
require "json"
url = "http://www.emplea.do/jobs.json"
resp = Net::HTTP.get_response(URI.parse(url))
data = resp.body
@result = JSON.parse(data)
puts @result
@hminaya
hminaya / json-api-python.py
Last active December 16, 2015 05:18
get JSON api with python
import urllib2
import simplejson
url = "http://www.emplea.do/jobs.json"
resp = urllib2.Request(url)
opener = urllib2.build_opener()
data = opener.open(resp)
result = simplejson.load(data)
@hminaya
hminaya / json-api-node.js
Last active December 16, 2015 05:19
get JSON api with node (server side javascript)
var http = require('http');
var url = 'http://www.emplea.do/jobs.json';
http.get(url, function(res) {
var body = '';
res.on('data', function(chunk) {
body += chunk;
});
@hminaya
hminaya / json-api-java.java
Last active May 11, 2018 10:45
get JSON api with Java
package com.hminaya.storage;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
@hminaya
hminaya / json-api-csharp.cs
Created April 15, 2013 01:07
get JSON api with C#
using System;
using System.Net;
using Newtonsoft.Json;
namespace api
{
class MainClass
{
public static void Main (string[] args)
{
@hminaya
hminaya / seed.rb
Created April 22, 2013 14:48
Genera un archivo con numeros aleatorios dentro de un rango
file = File.open("seed.txt", "w")
20.times do
one = Random.rand(1...500000)
two = Random.rand(500000...2000000)
file.write("#{one} #{two}\n")
end
@hminaya
hminaya / seed.txt
Last active December 16, 2015 12:38
Data de prueba con numeros aleatorios
235952 696834
410744 1972018
482537 762623
266013 1506104
332936 1357451
115587 1881152
255431 833493
437349 1833622
384940 1333384
45184 1263934
@hminaya
hminaya / palindrome-one.rb
Last active December 16, 2015 12:38
Primer ejemplo en ruby de como encontrar si un numero es un palíndromo
def is_palindrome?(num)
s = num.to_s
s == s.reverse
end
count = 0
File.open("seed.txt") do |f|
while line = f.gets
one = line.split[0]
two = line.split[1]