A page I’ve had since forever just got a minor facelift. I’m watching Helvetica, the movie, so… yeah.
Copy to clipboard from command line
I just discovered a couple useful command-line tools on OSX and thought I’d share. pbcopy will copy stdin
to the clipboard and pbpaste will send the clipboard to stdout
.
$ cat somefile.txt | pbcopy #copy a file to the clipboard $ pbpaste | grep foo #search the clipboard for foo
Handy.
Black Friday @ Amazon
Black Friday is coming up and Amazon appears to be running some great deals. Be sure to check it out if you don’t feel like standing in line all morning. They’re also running their Amazon Customers Vote! deal again where you get to vote on which deal you want.
(disclaimer: these are affiliate links, so I get a small cut if you buy things after following them. either way, Amazon runs some great deals during the holidays if you keep your eyes peeled, so I don’t feel weird offering them here.)
Making Grenadine
You may have had grenadine before. It’s a pretty common mixer for stiffish drinks and is usually a bright red color. I’d always thought it a product of some lab, maybe cough syrup gone bad, but I found out it was originally just a pomegrante syrup.
So tonight I made some. Bring two cups of pomegrante juice (I used Pom) to a boil and reduce by half. Lower the heat and stir in one cup of sugar. Simmer for a couple of minutes to dissolve then cool. Delicious!
Should store in the fridge for a couple weeks.
window.baz vs var baz. A subtle oddity.
While trucking away at $work, Jim pointed out a subtle nasty edge case in how JavaScript and the browser interact. Let’s say you have the following code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>shared var</title> <script type="text/javascript"> var foo = "awesome"; bar = "bartastic"; window.baz = "bazzoom"; </script> <script type="text/javascript"> if(!window.foo) var foo = "not awesome"; if(!window.bar) var bar = "not bartastic"; if(!window.baz) var baz = "not bazzoom"; </script> </head> <body> <p>Foo is <script type="text/javascript">document.write(foo);</script></p> <p>Bar is <script type="text/javascript">document.write(bar);</script></p> <p>Baz is <script type="text/javascript">document.write(baz);</script></p> </body> </html>
I think most folks would expect the output to be:
Foo is awesome
Bar is bartastic
Baz is bazzoom
and it is on Firefox, Safari and Opera, but on IE you get:
Foo is awesome
Bar is bartastic
Baz is not bazzoom
Care to guess why?