This file contains hidden or 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
" Select the current method | |
" | |
" ]M move to the end of the method | |
" V enter visual line mode | |
" % move to the matching open brace | |
" | |
nnoremap <leader>m ]MV% | |
" Copy the current method and paste below | |
" Use this after the above |
This file contains hidden or 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
pirl @> sub hats : lvalue { my ($self) = @_; $self->{hats}; } | |
@var = (); | |
pirl @> $obj = bless {} | |
@var = ( | |
bless( {}, 'Shell::Perl::sandbox' ) | |
); | |
pirl @> $obj->hats | |
@var = ( | |
undef | |
); |
This file contains hidden or 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
# Example usage of https://www.artima.com/weblogs/viewpost.jsp?thread=101605 | |
# with added commutativity | |
import itertools | |
registry = {} | |
class MultiMethod(object): | |
def __init__(self, name): | |
self.name = name |