Do you want to have a shortcut that takes you from a method call to it’s definition, wherever that may be in your code? How about another shortcut to jump back to your previous position. Here is how to do it in Sublime Text 2
In the UNIX paradigm, everything is a file system. So, it makes sense that there is a utility to work with open files.
A common use case is to try to eject a mounted drive or clear the trash and get a warning about a locked file. What process has this file or folder open?
1 2 3
Since everything is a file, it works just as well with ports:
1 2 3
Or you can check the files for a specific program:
1 2 3 4 5 6 7 8 9 10 11
lsof supports many, many options, read the man pages for more information.
If you call yourself a ruby programmer, you should read this book.
Sandi Metz has done a great job explaining how to write maintainable applications, in a way that is accessible to programmers at any skill level. Her book is concise (less than 250 pages, including the index), but jam-packed with great nuggets of practical advice and coding techniques that you can start applying immediately in your projects. Her style is easy to read, with many code examples that show you the evolution of code, as an application changes and is refactored.
Among the techniques discussed:
- Use dependency injection to avoid coupling between objects. (Makes them easier to test too)
- To write great APIs, focus on the messages being sent between objects. (She shows why you would actually want to use a UML diagram)
- By creating role tests and applying them to test doubles, you can avoid the ‘leaving the dream’ problem, where stubs in tests obscure the fact that objects interfaces have changed.
When passing a message to StandardError in ruby 1.8, it will keep that object intact. Ruby 1.9 will convert to a String. Spent more time than I wanted to chasing this down.
In ruby 1.8.7:
1 2 3 4 5 6
In ruby 1.9.3:
1 2 3 4 5 6
In ruby > 1.9 lambdas are picky about arguments passed when calling and will raise
ArgumentError. Procs, will
nil as the argument values.