Skip to content

Instantly share code, notes, and snippets.

View GustavoCaso's full-sized avatar
🧩

Gustavo Caso GustavoCaso

🧩
View GitHub Profile
@GustavoCaso
GustavoCaso / job_scheduler_using_ractor.rb
Last active January 5, 2021 04:30
Simple implementation for a job scheduler using ruby Ractor primitive
# How to install the latests version of ruby
# 1. clone ruby/ruby
# 2. autoconf
# 3. ./configure
# 4. cd ext/openssl && ruby extconf.rb --with-openssl-dir=<openssl_root>; make; make install
# 5. cd ../../
# 6. make
# 7. make install-nodoc
# You should be ready ti run this script!!!!
@GustavoCaso
GustavoCaso / build_min_max.rb
Created November 8, 2018 20:57
building min max array
require 'bundler/inline'
require 'benchmark'
gemfile do
source 'https://rubygems.org'
gem 'pry'
end
LAST_ITEM_SCORE = 1573263909
THREE_WEEKS_FROM_NOW = 1543521400
@GustavoCaso
GustavoCaso / Gemfile.lock
Created October 21, 2018 20:30
hanami controller handling exception issue
GIT
remote: git://github.com/davydovanton/dry-system-hanami.git
revision: ae0506d4a858921936843501462cb36f55a9c3b0
specs:
dry-system-hanami (0.1.0)
GEM
remote: https://rubygems.org/
specs:
addressable (2.5.2)
@GustavoCaso
GustavoCaso / analyzer_benchmark.rb
Last active October 22, 2018 13:32
Benchmark for Analyzer
require 'bundler/inline'
require 'benchmark'
gemfile do
source 'https://rubygems.org'
gem 'pry'
end
number_of_job_payload = ARGV[0].to_i || 100_000
@GustavoCaso
GustavoCaso / flatten.ex
Last active July 31, 2017 21:00
Flatten Exercise
defmodule Flatten do
def flat(list) do
cond do
is_list(list) -> flat(list, []) |> Enum.reverse
true -> {:error, "Must pass a List"}
end
end
def flat([], acc), do: acc
@GustavoCaso
GustavoCaso / clipboard.rb
Created July 1, 2016 14:28
Error Handling discussion
module Hybridflow
class CRMMessageParser
class Clipboard
attr_reader :message, :context, :error_handler
def self.car_rental_providers
providers = Pathify::CarProvider.all.map{ |p| p.name.try(:downcase).try(:strip) }.compact
providers.empty? ? _car_rental_providers : providers
rescue
_car_rental_providers
@GustavoCaso
GustavoCaso / include_module.rb
Last active April 19, 2016 10:25
Testing alias_class for future project
module AliasClass
def self.included(base_class)
base_class.class_eval do
def self.alias_class(original_class, new_class)
self.const_set(new_class, original_class)
end
end
end
end
@GustavoCaso
GustavoCaso / sublime_text.configuration.md
Last active September 14, 2015 17:00
Sublime text Configuration
@GustavoCaso
GustavoCaso / .vimrc
Last active July 12, 2016 21:37
Vim configuration
## Plugins
1. curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
2. cd ~/.vim/bundle && git clone https://github.com/scrooloose/nerdtree.git
3. cd ~/.vim/bundle && git clone https://github.com/kien/ctrlp.vim.git
4. cd ~/.vim/bundle && git clone git://github.com/tpope/vim-fugitive.git
5. cd ~/.vim/bundle && git clone [email protected]:altercation/vim-colors-solarized.git
* * *