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 / add-support-to-array-to-emberjs-models
Last active August 29, 2015 14:07
add support to array attributes 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 February 11, 2015 21:08
All Minitest Assertions
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 March 17, 2015 00:38
find and replace text in files recursively
# 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 September 9, 2015 17:14
Running ActiveRecord specs
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 September 14, 2015 14:48
Fish Shell config file with git branch and current RVM
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)
@Rodrigora
Rodrigora / git branch on prompt
Created June 4, 2013 16:11
git branch on prompt
parse_git_branch() {
if ! git rev-parse --git-dir > /dev/null 2>&1; then
return 0
fi
// 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 {
{
"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 / 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,
@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