This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
parse_git_branch() { | |
if ! git rev-parse --git-dir > /dev/null 2>&1; then | |
return 0 | |
fi | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DS.ArrayTransform = DS.Transform.extend | |
deserialize: (serialized)-> | |
if Ember.typeOf(serialized) == "array" | |
serialized | |
else | |
[] | |
serialize: (deserialized)-> | |
type = Ember.typeOf deserialized | |
if type is 'array' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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" {} \; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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" {} + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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", |
OlderNewer