Skip to content

Instantly share code, notes, and snippets.

View rafb43's full-sized avatar

Rafael Bandeira rafb43

View GitHub Profile
@rafb43
rafb43 / tags-fix-attempt
Last active March 18, 2016 21:29
`ctags` doesn't seem to play well with namespaced ruby class names out of the box. Even trying with `--extra=q`. `ripper-tags` seems to fix it.
#!/usr/bin/env ruby
`/usr/bin/env ctags -R #{ENV["PWD"]}/app`
tags_file = "#{ENV["PWD"]}/tags"
tags = File.read(tags_file)
fixed_tags = tags.split(/\n/).map do |line|
is_rb = line =~ /\.rb/
if is_rb
name = line.gsub(/^.+(?:class|module) ([a-zA-Z0-9:]+).+$/, '\1')
@rafb43
rafb43 / remove_scheduled_resque_job.rb
Last active February 16, 2016 23:34
While using resque-scheduler 2.0.1, you have to delete scheduled jobs by hand
def remove_scheduled_resque_job(&block)
[].tap do |processed|
$redis.scan_each(match: "resque:delayed:*") do |key|
$redis.lrange(key, 0, -1).each do |value|
begin
payload = ActiveSupport::JSON.decode(value)
if yield(payload)
$redis.lrem(key, 1, value)
processed << value
end
# See https://bugsnag.com/docs/api
# Usage:
# client = BugsnagApiClient.with_token('<your account token>')
# data = client.with_error('<error id>').events(start_time: 5.days.ago, per_page: 30).map {|e| e['meta_data']['Custom']['target_id'] }
class BugsnagApiClient
attr_reader :rest_client
def self.with_token(bugsnag_auth_token)
rc = RestClient::Resource.new('https://api.bugsnag.com', headers: {'Authorization' => "token #{bugsnag_auth_token}"})
new(rc)
@rafb43
rafb43 / README.md
Created September 11, 2016 10:03
Lapis MacOS installation instructions LUA web development
LUAR
  • Download and install lua 5.1
  • Download and install luarocks
  • luarocks install luacrypto OPENSSL_DIR=/usr/local/opt/openssl OPENSSL_INCDIR=/usr/local/opt/openssl/include
  • luarocks install lapis
@rafb43
rafb43 / main.js
Created September 25, 2016 19:24
var obj;
var compound;
obj = function(name) {
var instance = {
name: name,
componenttype: obj,
};
var components = compound(instance);
instance.components = components;
instance.event = function(name, args) {