Tuesday, October 6, 2015

Non-Microsoft Development on Windows 10

A post on HN today about the MS Surface Book also discusses the topic of developing on Windows 10 vs. OS X.

A few notes from that discussion (as of 10/6/2015):

  • Cmder as a OS X Terminal replacement in Windows 10.
  • Babun as a shell environment (described as "cygwin on steroids with oh-my-zsh").
  • Mentioned that there is little documentation on setting up "non Visual Studio dev environments on Windows (RoR, Django, PHP/MySQL, etc)".
  • Also mentioned that Windows users are still a huge minority in non-MS/non-.Net communities so many tools, etc. aren't built with Windows users in mind. (Which we were aware of already.)

Wednesday, September 2, 2015

Recursively Search for Files Containing One String But Not Another

Building on the answer in StackExchange, here is the way to recursively search for files containing one string but not another:

grep -rL must_have_this_string some/path | xargs grep -l wont_have_this_string

There are other ways, but this works.

Tuesday, September 1, 2015

Staging Patches in Git

Don't typically do this at work, but learned this a little while back when there was a large file that required only partial changes. If you can avoid having a large file to partially stage, I highly recommend not doing it, but Git makes it easy to do this.

git add -p (optional pathname)

This goes into a mode where you can accept chunks to stage or alter those hunks to stage a patch. Think of it like an awesome patch editing tool.

For each hunk, say y to accept, n to not, s to split, e to edit. In e, if you replace the "-" at beginning of line with space, it won't stage that line. If you delete a line starting with "+", it won't stage that. Through this, you can do single line changes. Split is helpful in some cases, but even more helpful is the ability to use regular expressions to search for partial hunks to stage or unstage.

Similarly, git reset -p let's you undo staged changes.

There is even git checkout -p and git stash save -p, if needed.

Thursday, August 6, 2015

Turn on Net::HTTP Instance Debugging Externally

Here's a way to turn on HTTP::Net debug, if you don't want to patch something that is using it or use some other method to debug:

module Net
  class HTTP
    alias_method :debug_renamed_initialize, :initialize
    def initialize(*args, &block)
      http = debug_renamed_initialize(*args, &block)
      self.set_debug_output $stderr

Disabling an Automatically Added Search in Chome's Omnibox

There is one site at work that I almost never want to search from Chrome's Omnibox, but it does anyway. There are a few ways to get around this that worked for me that I got from question on SuperUser:
  • Go into (for OS X) Chrome -> Preferences -> Manage Search Engines and change the keyword for each search engine under "Other Search Engines" to something you'd probably never type, like '@#$%@#$'.
  • Prefix search with space or question mark.

Tuesday, August 4, 2015

Undoing Yosemite Multi-monitor and Window Fullscreen Behavior

Undoing OS X 10.10 Yosemite window behavior, because it kept bugging me, and just had to figure it out again.

If you only uncheck displays have separate spaces, when it fullscreens via the green button on a window, it turns the other display black, which is stupid. Instead you have to do that AND redefine the green button behavior to just maximize:

  1. System Preferences -> Mission Control -> Uncheck "Displays have separate spaces".
  2. Install BetterTouchTool. During install, don't agree to window snapping and ensure you give it rights to manage.
  3. Select "Other" category at the top of the window.
  4. Make sure that "Global" is selected at the left side.
  5. Click "Configure New Trigger" button in the bottom part of the window.
  6. Under Trigger, select "Leftclick Green Window Button".
  7. Under Predefined Action, select "Maximize Window".
  8. In Basic Settings, check Launch BetterTouchTool on startup.

This is from here and here.

As a related tip, to make a window smaller but not minimize, double-click on the menu bar.

Thursday, May 28, 2015