Skip to content

Instantly share code, notes, and snippets.

View pote's full-sized avatar

pote pote

View GitHub Profile
[
{
"nombre": "Agazzi, Ernesto",
"link": "https://parlamento.gub.uy/camarasycomisiones/legisladores/5146",
"id": "5146",
"citaciones": 97,
"asistencias": 97,
"faltas_con_aviso": 0,
"faltas_sin_aviso": 0,
"no_citado_por_licencia": 10,

En tu .bashrc

alias movie="curl https://movieprodwebapi.azurewebsites.net/api/shows/content/weekly/list?showType=cinema | jq '.[].name'"

alias endgame="movie | grep -E 'Avengers|Vengadores' && say 'WHATEVER IT TAKES'"

Prerequisito: tener instalado jq

@pote
pote / example.go
Last active February 4, 2018 04:01
// So, in order to unmarshal json easily with Go it's important to code Go structs that
// follow the structure of the data you will receive. It might be a bit of extra coding
// up front, but I think it has some nice benefits since you can then can work with native
// structs and have type safety enforced.
// Keep in mind that this is an example so my naming might not be the best, but I hope it
// will be helpful to you anyways.
// I created the structs and their relationships based on the sample response from the API
// documentation you sent me, which is copied at the bottom for clarity.

Keybase proof

I hereby claim:

  • I am pote on github.
  • I am pote (https://keybase.io/pote) on keybase.
  • I have a public key ASChCUPzS9zSHI-E8Bf-8_0LjfpSmeI6yA13dWIQxTQG4Ao

To claim this, I am signing this object:

@pote
pote / Makefile
Last active October 13, 2015 11:56
Golang binary embeddable views
##
# This Makefile is a slimmed down version from an actual project, to make deployment
# easier all the html files in `views/` are copied into Go files as constants and
# placed under `src/views/`, assuming `GOPATH="$PWD/.deps:$PWD" (1) this means that in
# your code you can get the contents of `views/index.html` as `views.INDEX`.
#
# There is also how I handle dependencies with gpm, which is unrelated, but I though
# I'd leave it for the hell of it.
#
# (1) You don't need to have that exact GOPATH, but "$PWD" does need to be included in
@pote
pote / 0_reuse_code.js
Last active August 29, 2015 14:09
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
---
- hosts: web
sudo: yes
accelerate: true
vars:
app_dir: "/var/www/the_application_name_goes_here"
server_env:
RACK_ENV: "production"
SSO_SALT: "esta no es la salt de verdad"
REDIS_URL: "redis://rest_of_url"
@pote
pote / active_record_hack.rb
Created February 5, 2014 20:17
Single Table Inheritance
# Use in subclasses like:
# delegate_details :win_ratio, :tanning_time, to: :wrestling_details
def self.delegate_details(*attributes)
options = attributes.extract_options!
association_name = options.fetch(:to) {
raise ArgumentError.new "You must specify the name of the details association"
}
define_method association_name do
super() || send("build_#{association_name}")
@pote
pote / Gemfile
Created February 5, 2014 20:14
ruby versioning
gem 'nokogiri', :git => 'git://github.com/sparklemotion/nokogiri.git', :tag => 'v1.6.0'
@pote
pote / cli.sh
Last active August 29, 2015 13:56
Adventure in variable scoping
Hyrule ~/code/tmp
▸ go run scoping.go
./scoping.go:14: variable is shadowed during return