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 / Prueba Líder Tecnico
Last active March 5, 2018 21:43
Líder Tecnico - entrevista - interview
Introduction to the problem
You are free to implement any mechanism for feeding input into your solution. You should provide sufficient evidence with unit tests that your solution is complete. As a minimum, please use the provided test data to indicate that the solution works correctly. Any programming language can be used to solve the problem.
Drawing tool
You're given the task of writing a simple console version of a drawing program. At this time, the functionality of the program is quite limited but this might change in the future. In a nutshell, the program should work as follows:
Create a new canvas
Start drawing on the canvas by issuing various commands
@niquepa
niquepa / gist:4c59b7d52a15dde2367a
Last active January 25, 2023 23:51
Ruby rails extract youtube ID from URL
def youtube_id(youtube_url)
regex = /(?:youtube(?:-nocookie)?\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/
match = regex.match(youtube_url)
if match && !match[1].blank?
match[1]
else
nil
end
end
#!/bin/ruby
n = gets.strip.to_i
bin = n.to_s(2)
#puts bin
state = nil
max = 0
count = 0
bin.each_char do |char|
if state == char
# Enter your code here. Read input from STDIN. Print output to STDOUT
n = gets.to_i
arr = gets.split(" ")
arr.map! { |i| i.to_i }
#puts arr
arr = arr.permutation(3).to_a.sort.uniq
work = Array.new
arr.each do |perm|
#puts "PERM => #{perm.sort}"
work.push(perm.sort)
class Solution
# Write your code here
def initialize
@stack = Array.new
@queue = Array.new
end
def pushCharacter(c)
@stack.push(c)
end
#!/bin/ruby
n = gets.strip.to_i
a = gets.strip
a = a.split(' ').map(&:to_i)
#puts a
endPos = a.count-1
swapCont = 0
#puts "ENDPOS=#{endPos}"
@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 / 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%'