Skip to content

Instantly share code, notes, and snippets.

@romeuhcf
romeuhcf / rubocop.1.yml
Created November 15, 2018 14:22
Rubocop 2.5 config maturity level 1
AllCops:
TargetRubyVersion: 2.5
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
# to ignore them, so only the ones explicitly set in this file are enabled.
DisabledByDefault: true
Include:
- '**/*.podspec'
- '**/*.jbuilder'
- '**/*.rake'
- '**/*.opal'
@romeuhcf
romeuhcf / basegame.js
Created February 26, 2019 18:37
Basic game loop
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext("2d");
canvas.width = 400; canvas.height = 300;
var mousePos = {x: 0, y:0};
var lastFrameTimeMs = 0,
maxFPS = 60,
@romeuhcf
romeuhcf / sidekiq clean
Created June 26, 2019 01:09
Safely remove every empty sidekiq queue.
redis-cli EVAL 'local n = 0 ; local qs = redis.call("smembers","queues"); for _,q in ipairs(qs) do local qname = "queue:"..q ;if redis.call("llen", qname) == 0 then redis.call("srem", "queues", q) ; redis.call("del", qname); n = n+1 end end ; return n' 0
@romeuhcf
romeuhcf / rest.rb
Created December 17, 2019 13:53
Multi verb http
require 'net/http'
require 'uri'
def call(method:, host:, path: '/', query_parameters: {})
method = method.to_s.downcase
method = method[0].upcase + method[1..]
uri = URI(File.join(host, path))
uri.query = URI.encode_www_form(query_parameters)
# TODO POST raw payload
### Keybase proof
I hereby claim:
* I am romeuhcf on github.
* I am romeuhcf (https://keybase.io/romeuhcf) on keybase.
* I have a public key ASACRh7aWrFw-4nozzqCZeE7Cp8a9Dh4vhZQciZyUr8-Wwo
To claim this, I am signing this object: