Skip to content

Instantly share code, notes, and snippets.

View niquepa's full-sized avatar

Carlos Castillo niquepa

  • New York
View GitHub Profile
@niquepa
niquepa / signal_catching.rb
Created March 8, 2017 19:25 — forked from sauloperez/signal_catching.rb
How to catch SIGINT and SIGTERM signals in Ruby
# Signal catching
def shut_down
puts "\nShutting down gracefully..."
sleep 1
end
puts "I have PID #{Process.pid}"
# Trap ^C
Signal.trap("INT") {
@niquepa
niquepa / postgres_queries_and_commands.sql
Last active November 27, 2017 15:02 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@niquepa
niquepa / interview.md
Last active March 5, 2018 21:43 — forked from diegosky1/interview.md
Entrevista técnica - Play Business - interview

Bienvenido, de una serie de aplicantes tu y algunos candidatos más pasaron a la fase de entrevista. El objetivo de esta prueba es simplemente conocer tu estilo de programar y analizar tu creatividad para desarrollar algo cuando tienes poca información. Esto sucede todo el tiempo en Play Business y tenemos una cultura tatuada de MVPs para probar nuestros conceptos, prueba los tuyos con estos drills.

Algo de calentamiento!!

1.- Imagina que tienes un arreglo de 1,000 valores (del 1, 2, 3,.. 1,000). Sin embargo, al analizar el tamaño del arreglo te das cuenta que faltan dos valores, no sabes cuales son. Escribe un método que permita saber los valores faltantes y dime por qué decidiste hacerlo de esa manera, ¿Cual es la ventaja?

Fácil hasta ahora verdad? Ok...

2.- Construye Pinterest.

##BONUS. Algo de Git. 3.-El equipo de desarrollo está implementando una serie de features importantes, por lo que tenemos las branches: feature1, feature2 y feature3, a demás de Master. Surgió un pendiente y se tiene que

@niquepa
niquepa / ruby_job_interview_questions_es.md
Last active March 5, 2018 21:44 — forked from GusGA/ruby_job_interview_questions_es.md
Posibles preguntas de una entrevista de trabajo para Ruby y Ruby on Rails - entrevista - interview

INTERVIEW QUESTIONS

  • continous integration's tools
  • WorkFlow to promote code to production, GitFlow, Releases?
  • Tell us more about your experience with GIS
  • Tools for Performance Tests (Selenium)
  • Tools for code review and best practices
  • Ldap/oAuth integrations - SingleSignOn
  • Experience migrating data from legacy systems
  • What are gems and name your favorites
@niquepa
niquepa / PostgreSQL-Upgrade.md
Created March 23, 2018 15:18 — forked from giannisp/gist:ebaca117ac9e44231421f04e7796d5ca
Upgrade PostgreSQL 9.6.5 to 10.0 using Homebrew (macOS)

After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work. The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0."

Database files have to be updated before starting the server, here are the steps that had to be followed:

need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default

brew unlink postgresql brew install postgresql@9.6 brew unlink postgresql@9.6 brew link postgresql

@niquepa
niquepa / rails http status codes
Created June 20, 2018 17:09 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@niquepa
niquepa / RGeo_with_Proj.md
Created November 8, 2019 16:32 — forked from peterwake/RGeo_with_Proj.md
Installation of RGeo with Proj support (also called Proj4)

Installation of RGeo with Proj support (also called Proj4)

This is a real pain as of writing (18 Oct 2019). I can't promise it'll work either :)

Reference

Let's start from the beginning...

If you've been hacking around already you should do:

@niquepa
niquepa / helper.scss
Created March 10, 2020 19:17 — forked from alalfakawma/helper.scss
Bulma SCSS Table column width helper
/*
Author: Aseem Lalfakawma <alalfakawma.github.io>
This SCSS mixin will allow sizing of table columns in Bulma CSS Framework.
The Bulma framework does not support this yet, this small code snippet fixes this.
USAGE:
* Should be applied on TH element, it controls all the columns under it *
The class should be "is-#",
is-1 will give the first widthamount, is-2 will give the second.
Eg. The code below shows the widthAmounts as (1, 2.5, 3, 4 , 5, 6, 7)
@niquepa
niquepa / setup-gh-cli-auth-2fa.md
Created April 14, 2020 13:16 — forked from ateucher/setup-gh-cli-auth-2fa.md
Setup git on the CLI to use 2FA with GitHub

These are instructions for setting up git to authenticate with GitHub when you have 2-factor authentication set up. This authentication should be inherited by any GUI client you are using. These are intentionally brief instructions, with links to more detail in the appropriate places.

  1. Download and install the git command-line client (if required).

  2. Open the git bash window and introduce yourself to git (if required):

    git config --global user.name 'Firstname Lastname'
    git config --global user.email 'firstname.lastname@gov.bc.ca'
    
@niquepa
niquepa / Gemfile
Created June 25, 2020 13:52 — forked from dhh/Gemfile
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers