Textmate hack: A keyboard shortcut for opening files in a new window

one comment    Posted on May 11th, 2011

Textmate has no split windows, and you can’t open the same file within a project in a new window without resorting to using the mouse. Here’s what I mean:

textmate open in new window

Situations often arise where you have to refrence one file while editing another. Maybe you want to view a header file while editing its implementation code. Or maybe you want a TODO list in one window while working on the rest of your code base.

In these scenarios tabbed editing becomes extremely painful, and the alternative of mousing around to open a new window has always felt like a clunky solution to me. Here’s a hack to create a keyboard shortcut for opening files in new windows. Oh what a hack it is:

#!/bin/sh

tof=`echo $TM_FILEPATH`
echo $tof

mate "$tof" .RANDOM_STRING_DOES_NOT_MATTER && osascript <<EOF
tell application "System Events"
    delay 0.2
    tell application "TextMate" to activate
    keystroke "t" using {command down}
    keystroke return
    keystroke "d" using {command down, control down, option down}
end tell
EOF

To use this, create a new bundle command, add this code to it, and associate your keyboard shortcut to the command.



So that’s how tracing JITs work …

   Posted on April 7th, 2011

From PyPy’s blog: Adding a JIT to your interpreter

When it (the jit compiler) detects a loop of code in the target language that is executed often, the loop is considered “hot” and marked to be traced. The next time that loop is entered, the interpreter gets put in tracing mode where every executed instruction is logged.

When the loop is finished, tracing stops. The trace of the loop is sent to an optimizer, and then to an assembler which outputs machine code. That machine code is then used for subsequent loop iterations.

(The generated machine code) depends on several assumptions about the code. Therefore, the machine code will contain guards, to validate those assumptions. If a guard check fails, the runtime falls back to regular interpreted mode.

This is one of the best explanation of JIT compilers I’ve found. I finally understand how they work after hearing the term tossed around so much lately.



Daily Signal (May 10, 2010)

   Posted on May 10th, 2010

  • Pandas – R’s dataframes in Python
    • Pandas is a python package for working with timeseries data. I’ve been looking a long time for an equivalent to R’s dataframe functionality within python and this is it. What makes these dataframe structures so special is their ability to quickly slice and dice a table of data.
  • node.js, jsdom and jQuery

    • JSdom allows you emulate the entire document object model of a webpage without running a browser. I just found out today that node.js now runs jsdom and jquery seamlessly. This is nothing short of a webscraping revolution.
  • CryptoJS

    • A cryptographic library for Javascript. Perfect use case: Interactive API documentation. Got an api service? Want developers to adopt quicker? Allow them to submit signed API calls within your webpages.
  • The MarketPlace Play

    • A detailed analysis of the marketplace business model.