git-checkout 0f0d8a27622e7bf7f008983c4b8ee23bfb9843ab
editor path/to/file
git-add path/to/file
git-commit --amend -v
git-rebase --onto HEAD 0f0d8a27622e7bf7f008983c4b8ee23bfb9843ab master
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_for(Person.new, :update) | |
def source_for(object, method) | |
location = object.method(method).source_location | |
`mate #{location[0]} -l #{location[1]}` | |
location | |
end |
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
# This has the effect of moving all the lower items up one. | |
def decrement_positions_on_lower_items(position=nil) | |
return unless in_list? | |
position ||= send(position_column).to_i | |
acts_as_list_class.unscoped.update_all( | |
"#{position_column} = (#{position_column} - 1)", "#{scope_condition} AND #{position_column} > #{position}" | |
) | |
end |
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
%h1= "Listing " + "#{resource_name}s" | |
.btn-group.pull-right | |
= link_to "All #{resource_name(item: resource_class.superclass)}s", polymorphic_path([:admin, resource_class.superclass]), class: 'btn' | |
= link_to "Add #{resource_name}", new_resource_path, class: 'btn-primary btn' | |
%br | |
%br | |
%table.table.table-bordered.table-striped#sortable{:data => {update_url: polymorphic_path([:sort, :admin, resource_class])}} |
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
p ModelName.method(:method_name).source_location |
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
[merge] | |
tool = p4merge | |
keepBackup = false | |
[mergetool "p4merge"] | |
cmd = p4merge "$BASE" "$LOCAL" "$REMOTE" "$MERGED" | |
keepTemporaries = false | |
trustExitCode = false | |
keepBackup = false | |
[diff] | |
external = p4diff |
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
" remove trailing whitespace (don't use on binary files!!) | |
map <leader>tws :%s/\s\+$//<CR> | |
" go to previous file | |
map <Leader>p <C-^> |
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
# cat .editrc bind -v | |
bind -v |
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
s = 'supercalifragelisticexpealodocious' | |
s.scan(/\S{10}/).join('-\n') | |
# => "supercalif-\\nragelistic-\\nexpealodoc" |