Skip to content

Instantly share code, notes, and snippets.

Rodrigo R Aquino Rodrigora

Block or report user

Report or block Rodrigora

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Rodrigora
Rodrigora / bovespa.py
Created Feb 8, 2019 — forked from turicas/bovespa.py
Get stock prices from BMF Bovespa API
View bovespa.py
# 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 Oct 19, 2018
Useful VI commands for git
View vi-commands.sh
# GIT REBASE
# - VI replace pick -> fixup
:%s/pick/fixup/g
# replace " x x x" -> ""
:%s/\(\s\+x\)\+/\s/g
View kil_process.sh
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 Jun 13, 2018
Ruby script to delete git branches
View delete_branches.rb
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 — forked from simongong/camelSnake.js
JavaScript: convert format of object keys between camel-case and snake-case
View camelSnake.js
/**
* @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 — forked from blaze182/auth_helpers.rb
Request specs devise_token_auth Authentication helpers
View auth_helpers.rb
# 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
View iterm2-profile.json
{
"Use Non-ASCII Font" : false,
"Tags" : [
],
"Ansi 12 Color" : {
"Red Component" : 0.4405802488327026,
"Color Space" : "Calibrated",
"Blue Component" : 0.5168579816818237,
"Alpha Component" : 1,
View User.sublime-preferences
{
"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",
@Rodrigora
Rodrigora / replace-in-files.sh
Last active Mar 27, 2017
Replace string in files
View replace-in-files.sh
# finds all files in app folder with .rb extension
# for each file
# capitalizes every "cr" strings preceded by a non-letter and followed by a capital letter
find app -name '*.rb' -exec sed -i '' -- "s/\([^a-zA-Z]\)[Cc][Rr]\([A-Z]\)/\1CR\2/g" {} +
# rename PGIntegrationError -> CRProviderError
find app -name '*.rb' -exec sed -i '' -- "s/PGIntegrationError\CRProviderError/g" {} +
find app spec config lib -name '*.rb' -exec sed -i '' -- "s/pg_integration_error\?\cr_provider_error\?/g" {} +
@Rodrigora
Rodrigora / request_macros.rb
Created Sep 19, 2015
Helper for requests specs with authenticity token
View request_macros.rb
module RequestMacros
def login_user(user = nil)
user = create(:user, password: 'password') unless user
# ensure password is valid when `user` is provided
expect(user.valid_password?('password')).to be(true)
# ensure user is confirmed
user.confirm!
You can’t perform that action at this time.