oo! As long as we're sharing our favourite terminal tips, here's mine: In your .bash_profile, add this line: alias imgsz='sips -g pixelWidth -g pixelHeight' sips stands for "scriptable image processing system"[1], and provides terminal users with a toolset for inspecting and manipulating images. The alias above is really useful for web developers who need a quick look at how big a given image is: $ imgsz logo.png /pa…
thank you!
Quick tip for developers who use OS X
381–390 of 406 posts
Re: Quick tip for developers who use OS X
#382Nobody seems to have posted this yet: python -m SimpleHTTPServer I'd recommend an alias like "serve". It basically puts the current directory online (binds to 0.0.0.0:8000).
Am I wrong to have long dismissed this as little more than an easter egg, or, at best, a toy server to test basic webpage functionality?
Re: Quick tip for developers who use OS X
#383drag + drop files to terminal to get its location. I often do "cd " + dragon drop folder to get to that folder in terminal
Re: Quick tip for developers who use OS X
#384Earlier quoted context omitted.
Am I wrong to have long dismissed this as little more than an easter egg, or, at best, a toy server to test basic webpage functionality?
The only problem it really solves is if you've got non-relative paths in your HTML/CSS. I've used this a couple of times in those situations.
Re: Quick tip for developers who use OS X
#385These two commands replace 'cd' and work with a directory stack of different paths.
$ pushd tmp # cd to tmp and remember current path /
/tmp /
$ pwd
/tmp
$ cd /usr # normal cd to wherever you want...
$ pwd
/usr
$ popd # pop the stck and get back to the previous path
/
$ pwd
/
Subsequent pushd will stack multiple paths.It's a built-in of bash and other shells. It works even with Windows' cmd.exe
Re: Quick tip for developers who use OS X
#386Re: Quick tip for developers who use OS X
#387Another really useful command is the open $ open filename.png $ open . $ open -e filename.txt $ open -a Pixen filename.png The first command will open the file with the default application. Open . will open the current directory in finder, which I find very helpful. The -e flag will open the file in textedit. The -a will open the file in the given application name.
open -n is also useful: Allows you to run two instances of the same app at a time.
Re: Quick tip for developers who use OS X
#388Earlier quoted context omitted.
"Paste and match formatting" shouldn't be necessary for most programs, and isn't a platform standard. Paste is command-V. A sensible application should do the most likely thing the user wants with paste and overload the shortcut for weird stuff. The fact that Microsoft consistently does the weird thing by default isn't a platform problem with the Mac, just with Word. Now you could point out Pages has the same shortcu…
"Paste and match formatting" shouldn't be necessary for most programs, and isn't a platform standard. Yes, it is. https://developer.apple.com/library/mac/documentation/UserEx... says "Table A-2 lists the system-reserved and commonly used keyboard shortcuts mentioned in the rest of this document." Table A-2: contains ../art/ks_option_2x.png ../art/ks_shift_2x.png ../art/ks_command_2x.png V Apply the style of the surro…
I'm suggesting the standard paste should behave as expected, not adhere to some literal definition the user doesn't care about. If I copy a passage of text from one document and paste it into another, I generally want it to look like it belongs in the destination document but I don't want to lose obvious intentional styling such as italicization.
The common case should be the easy case. Instead we have the common case and the four-fingered shortcut both doing the wrong thing. Awesome.
Re: Quick tip for developers who use OS X
#389Earlier quoted context omitted.
Also very useful for similar use cases is qlmanage. $ qlmanage -p
This seems to run whatever code usually runs when you hit [space] on a filename in a Finder window. (Except that it outputs a bunch of debugging information.) Under what circumstances is that any better or more useful than "open"?
$ qlmanage -p &>/dev/nullRe: Quick tip for developers who use OS X
#390The first thing I do when setting up a new Mac is make the Caps Lock key into another Control key. System Preferences > Keyboard > Modifier Keys Saves lots of awkward pinky-bending.
Is it me or do Mac Caps Lock keys require you to hold them down for close to a second for them to activate? There appears to be some kind of hardware timer in them to work...? I noticed this coming from Windows and Linux on other keyboards where tapping Caps Lock works but on Mac OSX with an Apple keyboard or on a Macbook you have to make a real deliberate effort to keep the key down longer than a nanosecond for it t…