Skip to content

Instantly share code, notes, and snippets.

View fernandoalmeida's full-sized avatar

Fernando Almeida fernandoalmeida

View GitHub Profile
@kule
kule / mini_rspec.rb
Created September 11, 2018 09:37
Simplified example of how rspec works
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'colorize'
end
class MatcherInterface
def initialize(some_object)
@some_object = some_object
import React from 'react';
import {
View,
Text,
} from 'react-native';
import { TextInputMask } from 'react-native-masked-text'
export default function maskedInputTemplate(locals) {
if (locals.hidden) {
return null;
@briankung
briankung / docker-pry-rails.md
Last active December 12, 2023 10:40
Using pry-rails with Docker

First, add pry-rails to your Gemfile:
https://github.com/rweng/pry-rails

gem 'pry-rails', group: :development

Then you'll want to rebuild your Docker container to install the gems

@keeth
keeth / api.tf
Last active January 13, 2021 14:34
Apex + Terraform + AWS Lambda + API Gateway + JSON Encoded Errors + CORS
resource "aws_api_gateway_rest_api" "myApi" {
name = "myApi-${var.env}"
description = "My awesome API (${var.env} environment)"
}
resource "aws_api_gateway_deployment" "myApi" {
depends_on = [
"aws_api_gateway_integration.myApi_myEndpoint_post",
"aws_api_gateway_integration_response.myApi_myEndpoint_post",
"aws_api_gateway_integration_response.myApi_myEndpoint_post_400",
@jrochkind
jrochkind / gist:488d4c5e63677038149d
Last active January 11, 2017 15:32
ruby_concurrent ThreadPool

Thread Pools

A Thread Pool is an abstraction that you can give a unit of work to, and the work will be executed by one of possibly several threads in the pool. One motivation for using thread pools is the overhead of creating and destroying threads. Creating a pool of reusable worker threads then repeatedly re-using threads from the pool can have huge performace benefits for a long-running application like a service.

concurrent-ruby also offers some higher level abstractions than thread pools. For many problems, you will be better served by using one of these -- if you are thinking of using a thread pool, we especially recommend you look at and understand Futures before deciding to use thread pools directly instead. Futures are implemented using thread pools, but offer a higher level abstraction.

But there are some problems for which directly using a thread pool is an appropriate solution. Or, you may wish to make your own thread pool to run Futures on, to be separate or have different characterist

@staltz
staltz / introrx.md
Last active April 29, 2024 09:25
The introduction to Reactive Programming you've been missing
@erikhenrique
erikhenrique / bin-cc.md
Last active February 5, 2024 16:06
Bin de cartões de crédito para validação

Validação para cartão de crédito.

Bin e padrões para validação de cartão de crédito.

Bandeira Começa com Máximo de número Máximo de número cvc
Visa 4 13,16 3
Mastercard 5 16 3
@bf4
bf4 / Gemfile
Created July 2, 2013 18:36
Rails lograge and logstash request logging
gem 'lograge' # more readable logs
gem 'logstash-event' # for logstash json format
gem 'mono_logger' # threadsafe logging
@ragingwind
ragingwind / Backend Architectures Keywords and References.md
Last active April 17, 2024 10:51
Backend Architectures Keywords and References
@willurd
willurd / web-servers.md
Last active April 28, 2024 21:38
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000