Skip to content

Instantly share code, notes, and snippets.

@picandocodigo
picandocodigo / ruby-advent-calendar-enterprise-search.md
Last active December 2, 2020 12:49
Ruby Advent Calendar - elastic-enterprise-search

elastic-enterprise-search

This gem is the official Elastic Enterprise Search client and it's currently out as a beta release. Enterprise Search is an Elastic solution for search in the enterprise. It's powered by the Elastic Stack and Elasticsearch, so you get all the great things you already know in one package for your team. It's the umbrella solution which contains Workplace Search, App Search and Site Search. The client focuses on App Search and Workplace Search.

What is Elastic Workplace Search?

Workplace Search is a unified search solution for teams. One of the interesting things about Workplace Search to me is at previous jobs I wished I had a product like this. We had different documents and manuals on so many different services: wikis, Jira, email, Dropbox, Basecamp. Whenever you needed to find a specific document you had to find out where to look for it, and then search. Workplace gives you a single search experien

@picandocodigo
picandocodigo / select.js
Created February 19, 2016 22:39
Limit a <select> checked count
// interests is a <select multiple> element
var interests = document.getElementById('interests');
interests.addEventListener('change', function(event){
var selected = this.querySelectorAll("option:checked");
if (selected.length > 3){
selected[0].selected = false;
}
});
require 'requests'
require 'tco'
while true do
begin
response = Requests.request("GET", "http://picandocodigo.net")
puts "WORKING".bg("#00FF00") if response.status == 200
`vlc http://www.youtube.com/watch?v=wOh968qao74 &`
break
rescue => e
#!/bin/sh
while true; do
inotifywait -e modify ../templates &&
handlebars ../templates/ -f ../js/templates.js
echo "Templates updated"
done
@picandocodigo
picandocodigo / emacs.el
Created March 13, 2014 04:59
My first Emasc config file
;LoadPath -
(if (fboundp 'normal-top-level-add-subdirs-to-load-path)
(let* ((my-lisp-dir "~/.emacs.d/")
(default-directory my-lisp-dir))
(setq load-path (cons my-lisp-dir load-path))
(normal-top-level-add-subdirs-to-load-path)))
;Color-theme
(require 'color-theme)
(setq color-theme-is-global t)
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.11 (GNU/Linux)
mQINBFJW01cBEADOAEhd2ErND2XaN7Hx7ptjYk2HJThLp4OfTBxOTqFjMraFEQXS
FsN09ocMsIVb2euKyOUQsBrq4UuUF5Vaax0F3vM7ok10/+G//g7jG+eY27xrX9x5
jrs7lhTyp3/zVjuCM0W+dFh5adY1qc/h6/FSlcCMKJ6EkC4iuS9qfOQgMOqx+pml
noaLaGPXfmhuYrW0Xt6GONSHyd36nvyVauDXbMugJ2d9U6nVOSgJPJmwu2G26Lql
mpwX8UCBZg+8D0eHwxlMMNudJaQ7P5wv8GS3e+376uJ6fSU1kWtUspUz7u/SErX5
nilzjeoAjSNgF6fUUrj7uVzvZn5GCO5app3UchSlF4HwdRxH9V6xHCm7X1a3KHip
JfLLdqoTPJvUlb+xSHoZVdryZhhdqA9mofsId1ZQdGL0z0H0nz560O3hfwGQarst
@picandocodigo
picandocodigo / speakerdeck-oembed.rb
Created February 14, 2013 17:59
Get speakerdeck oEmbed url
def slide(slide)
if slide.match('speakerdeck')
require 'net/http'
url = URI.parse("https://speakerdeck.com/oembed.json?url=#{slide}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
response = http.request(Net::HTTP::Get.new(url.request_uri))
response.body
end
end
desc "Create a new post, in Spanish and English."
task :new_post, :author, :title do |t, args|
post = <<-HTML
---
layout: post
title: TITLE
lang: LANG
author: AUTHOR
---
HTML
@picandocodigo
picandocodigo / ci.rb
Created January 2, 2013 21:01
Dígito verificador cédula
# ci = cédula
a = 0; (0..6).each { |i| a = a + ("2987634"[i].to_i * ci[i].to_i)}; puts (10 - (a % 10)).to_s[-1]
@picandocodigo
picandocodigo / README.markdown
Created December 4, 2012 22:39
README Ombud

Ombuduy

Proyecto para Desarrollando América Latina 2012 desde Uruguay. Sitio para reportar problemas en tu ciudad como arreglos en la calle, basura, y similares.

Problema a resolver

Los ciudadanos, usuarios de servicios municipales y estatales usan las redes sociales como medio de comunicación para expresar sus quejas y fallas en servicios. Esta aplicación pretende aprovechar esta masa crítica de incidentes reportados para hacer algo productivo con ello. Básicamente se trata de un intermediario entre la población y los entes responsables de poder trabajar sobre estos incidentes.

El objetivo es capturar quejas y reportes de problemas o incidentes de los ciudadanos a través de Twitter y otras redes sociales. La implementación inicial recupera datos solo de Twitter pero la idea es hacerlo disponible para las demás redes sociales y a través de un sitio web en sí mismo.