Skip to content

Instantly share code, notes, and snippets.

View golive's full-sized avatar

Gerbert Olivé Vázquez golive

View GitHub Profile
@swalkinshaw
swalkinshaw / tutorial.md
Last active February 26, 2025 21:15
Designing a GraphQL API
# File: /etc/apt/apt.conf.d/docker-autoremove-suggests
# Since Docker users are looking for the smallest possible final images, the
# following emerges as a very common pattern:
# RUN apt-get update \
# && apt-get install -y <packages> \
# && <do some compilation work> \
# && apt-get purge -y --auto-remove <packages>
# By default, APT will actually _keep_ packages installed via Recommends or
@zentetsukenz
zentetsukenz / ruby_on_rails_deployment.md
Last active December 2, 2024 01:26
Deploy Ruby on Rails application with Docker Compose and Capistrano with ease

Docker

Files and Folders.

|
|\_ app
|...
|\_ docker
| |
#### Move queue data between machines ####
# Extract data as .yml file
rs = Sidekiq::RetrySet.new
report_yml = rs.to_a.to_yaml;
File.open('sidekiq_retries.yml', 'w') { |f| f.write(report_yml) }
# Read the data back
report_yml = File.open("sidekiq_retries.yml rb").read;
rs = YAML::load(report_yml);
VALID_IMAGE_SIGNATURES = [
"\x89PNG\r\n\x1A\n".force_encoding(Encoding::ASCII_8BIT), # PNG
"GIF87a".force_encoding(Encoding::ASCII_8BIT), # GIF87
"GIF89a".force_encoding(Encoding::ASCII_8BIT), # GIF89
"\xFF\xD8".force_encoding(Encoding::ASCII_8BIT) # JPEG
].freeze
def file_is_image(temporary_file_path)
return false unless temporary_file_path
@dvrensk
dvrensk / redsys_result_codes.rb
Created February 4, 2015 17:02
These are the result codes from Spanish payment gateway Redsys (formerly Sermepa) that I've managed to collect. The list is no doubt incomplete, and I'll be happy to update it if you have any more codes.
RESULT_CODES = (<<-EOT).split(/\r?\n/).reject {|s| s.match(/^( *#.*)?$/)}.map { |s| s.sub(/^ +/,'').split(/ +/,2) }.to_h
# Copied from http://dwalins.com/2014/codigo-de-respuesta-de-sermepa-redsys/
0101 Tarjeta Caducada
0102 Tarjeta en excepción transitoria o bajo sospecha de fraude
0104 Operación no permitida para esa tarjeta o terminal
0106 Intentos de PIN excedidos
0116 Disponible Insuficiente
0118 Tarjeta no Registrada
0125 Tarjeta no efectiva
0129 Código de seguridad (CVV2/CVC2) incorrecto
@gbuesing
gbuesing / ml-ruby.md
Last active December 3, 2024 08:13
Resources for Machine Learning in Ruby

UPDATE a fork of this gist has been used as a starting point for a community-maintained "awesome" list: machine-learning-with-ruby Please look here for the most up-to-date info!

Resources for Machine Learning in Ruby

Gems

@JunichiIto
JunichiIto / alias_matchers.md
Last active March 27, 2025 14:04
List of alias matchers in RSpec 3

This list is based on aliases_spec.rb.

You can see also Module: RSpec::Matchers API.

matcher aliased to description
a_truthy_value be_truthy a truthy value
a_falsey_value be_falsey a falsey value
be_falsy be_falsey be falsy
a_falsy_value be_falsey a falsy value
@staltz
staltz / introrx.md
Last active April 21, 2025 04:15
The introduction to Reactive Programming you've been missing