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 / add-support-to-array-to-emberjs-models
Last active Aug 29, 2015
add support to array attributes to EmberJS models
View add-support-to-array-to-emberjs-models
DS.ArrayTransform = DS.Transform.extend
deserialize: (serialized)->
if Ember.typeOf(serialized) == "array"
serialized
else
[]
serialize: (deserialized)->
type = Ember.typeOf deserialized
if type is 'array'
@Rodrigora
Rodrigora / minitest_assertions.rb
Created Feb 11, 2015
All Minitest Assertions
View minitest_assertions.rb
def assert test, msg = nil
def assert_empty obj, msg = nil
def assert_equal exp, act, msg = nil
def assert_in_delta exp, act, delta = 0.001, msg = nil
def assert_in_epsilon a, b, epsilon = 0.001, msg = nil
def assert_includes collection, obj, msg = nil
def assert_instance_of cls, obj, msg = nil
def assert_kind_of cls, obj, msg = nil
def assert_match matcher, obj, msg = nil
def assert_nil obj, msg = nil
@Rodrigora
Rodrigora / commands
Created Mar 17, 2015
find and replace text in files recursively
View commands
# find text in files
grep -r "Text To Search" /path/to/search
# replace text in files
find . -name show.html.erb -exec sed -i "s/Text To Search/Text To Replace/g" {} \;
@Rodrigora
Rodrigora / Gemfile
Last active Sep 9, 2015 — forked from fnando/Gemfile
Running ActiveRecord specs
View Gemfile
source 'https://rubygems.org'
gem 'rails', '4.2.1'
gem 'sqlite3'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'bcrypt'
@Rodrigora
Rodrigora / config.fish
Last active Sep 14, 2015
Fish Shell config file with git branch and current RVM
View config.fish
set -g -x PATH /usr/local/bin $PATH
function fish_prompt --description 'Write out the prompt'
# Just calculate these once, to save a few cycles when displaying the prompt
if not set -q __fish_prompt_hostname
set -g __fish_prompt_hostname (hostname|cut -d . -f 1)
end
if not set -q __fish_prompt_normal
set -g __fish_prompt_normal (set_color normal)
View git branch on prompt
parse_git_branch() {
if ! git rev-parse --git-dir > /dev/null 2>&1; then
return 0
fi
View mask.js
// jQuery Masked Input
$('#celular').mask("(99) 9999-9999?9").ready(function(event) {
var target, phone, element;
target = (event.currentTarget) ? event.currentTarget : event.srcElement;
phone = target.value.replace(/\D/g, '');
element = $(target);
element.unmask();
if(phone.length > 10) {
element.mask("(99) 99999-999?9");
} else {
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" {} +
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,
You can’t perform that action at this time.