Skip to content

Instantly share code, notes, and snippets.

View Rodrigora's full-sized avatar
🏠
Working from home

Rodrigo R Aquino Rodrigora

🏠
Working from home
  • Dublin Ireland
View GitHub Profile
@Rodrigora
Rodrigora / stimulus_helper.rb
Created February 7, 2024 14:54
Stimulus/Capybara helper to ensure that the stimulus application loaded all controllers
module StimulusHelper
CouldNotLoadStimulus = Class.new(StandardError) do
def initialize(missing_controllers)
super("Could not load all controllers. missing: #{missing_controllers}")
end
end
# Reads the list of controllers from the filesystem
APPLICATION_CONTROLLERS = Dir[Rails.root.join('app/javascript/controllers/*')].map do |path|
File.basename(path).gsub('_controller.js', '').gsub('_', '-')
@Rodrigora
Rodrigora / steps
Last active May 30, 2019 10:10
setting up CTags for mac/sublime
Install JSON support
brew install jansson
Install Universal CTGAS
brew install --with-jansson --HEAD universal-ctags/universal-ctags/universal-ctags
Install CTAGS sublime plugin
https://github.com/SublimeText/CTags
Generate tags
@Rodrigora
Rodrigora / bovespa.py
Created February 8, 2019 10:43 — forked from turicas/bovespa.py
Get stock prices from BMF Bovespa API
# coding: utf-8
# Copyright 2015 Álvaro Justen <https://github.com/turicas/rows/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@Rodrigora
Rodrigora / vi-commands.sh
Last active October 19, 2018 13:34
Useful VI commands for git
# GIT REBASE
# - VI replace pick -> fixup
:%s/pick/fixup/g
# replace " x x x" -> ""
:%s/\(\s\+x\)\+/\s/g
@Rodrigora
Rodrigora / kil_process.sh
Last active December 12, 2018 10:29
Unix commands
kill -9 $(ps aux | grep spring | awk '{print $2}' | head -n 1)
kill -9 $(ps aux | grep webkit | awk '{print $2}' | head -n 1)
# Find files and remote by pattern
find /path/to/directory -type f -name '*[0-9]x[0-9]*[0-9]x[0-9]*.jpg' -delete
@Rodrigora
Rodrigora / delete_branches.rb
Created June 13, 2018 15:28
Ruby script to delete git branches
def delete_branches
pattern = /CT-\d{4}/
result = `git branch`
branches = result.split("\n").map(&:strip)
branches.each do |branch|
if branch =~ pattern
puts `git branch -d #{branch}`
@Rodrigora
Rodrigora / camelSnake.js
Created May 27, 2018 16:43 — forked from simongong/camelSnake.js
JavaScript: convert format of object keys between camel-case and snake-case
/**
* @param {Object|String} data string or keys of object are named in form of snake
* @param {number} depth to which level of keys should it process
* @return {Object|String} string or keys of object are named in form of camel case
*/
exports.snakeToCamel = function(data, depth) {
if (Util.isObject(data)) {
if (typeof depth === 'undefined') {
depth = 1;
}
@Rodrigora
Rodrigora / auth_helpers.rb
Created May 27, 2018 14:42 — forked from blaze182/auth_helpers.rb
Request specs devise_token_auth Authentication helpers
# spec/support/requests/auth_helpers.rb
module Requests
module AuthHelpers
module Extensions
def sign_in(user)
let(:auth_helpers_auth_token) {
self.public_send(user).create_new_auth_token
}
end
@Rodrigora
Rodrigora / iterm2-profile.json
Created November 6, 2017 23:29 — forked from anonymous/iterm2-profile.json
iterm2-profile
{
"Use Non-ASCII Font" : false,
"Tags" : [
],
"Ansi 12 Color" : {
"Red Component" : 0.4405802488327026,
"Color Space" : "Calibrated",
"Blue Component" : 0.5168579816818237,
"Alpha Component" : 1,
{
"bold_folder_labels": true,
"color_scheme": "Packages/Boxy Theme/schemes/Boxy Ocean.tmTheme",
"ensure_newline_at_eof_on_save": true,
"font_size": 21,
"highlight_line": true,
"ignored_packages":
[
"JavaScript",
"SublimeERB",