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 / reactTutorial1.js
Created August 3, 2017 21:27
React tutorial - play nine game
var possibleCombinationSum = function(arr, n) {
if (arr.indexOf(n) >= 0) { return true; }
if (arr[0] > n) { return false; }
if (arr[arr.length - 1] > n) {
arr.pop();
return possibleCombinationSum(arr, n);
}
var listSize = arr.length, combinationsCount = (1 << listSize)
for (var i = 1; i < combinationsCount ; i++ ) {
var combinationSum = 0;
@niquepa
niquepa / GIF-Screencast-OSX.md
Last active December 13, 2021 21:59 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF gif ffmpeg video

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@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 / 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 / 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 / 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

#!/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}"
class Solution
# Write your code here
def initialize
@stack = Array.new
@queue = Array.new
end
def pushCharacter(c)
@stack.push(c)
end
# 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)
#!/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