- Published:
- September 14, 2006 – 4:26 pm
- Author:
- By Dave
I recently had a problem where I was opening a browser window from an e-mail client. After taking a survey, I wanted a button to close this same window. In IE, it was fine to simply use window.close(); to close the window. However, Firefox, the evil genius that it is, will not let you do that because it believes you did not click to open this window in the first place. In order to trick it, you quick load a blank page then close it. The code: 12<a href="javascript:window.open(”,’_parent’,”);window.close();"> Close this window</a> So now, when you click the link, it closes the browser window. It works in both IE and Firefox 1.5 (and I believe others as well, but not personally tested). Finding that snippet of code saved me a lot of time! So I hope someone else finds it useful. Update, May 1 2008: This code only works on….
Categories: Code Samples,JavaScript
Tagged: firefox, JavaScript
- Published:
- September 13, 2006 – 8:07 pm
- Author:
- By Dave
Don’t you hate it when you try to visit a digg story and the site has been dugg? Use the greasemonkey firefox plugin and this duggmirror greasemoney script to add three links to each digg entry – the duggmirror archive, Coral NYU Mirror, and the Google Cache of the page, all with a nice graphical interface. It’s easy too: Install Firefox (you mean you haven’t already?) Install Greasemonkey plugin Restart Firefox Visit the duggmirror script‘s page and click “install this script”. A little box will pop up at the top of the browser screen, asking you for permission to install it. That’s it! When you visit digg – you will see the extra links next to the post title. It works in any OS that firefox support (I’ve personally tested on Windows XP, Vista, and Ubuntu).
Categories: JavaScript,Linux,System Administration,Windows
Tagged: Google, NYU
- Published:
- September 11, 2006 – 11:05 pm
- Author:
- By Dave
I am using the Visual.Syntax code highlighting plugin by Matthew Delmarter. There were some code highlighter plugins out there, but they were all pretty complicated and the output was fancier – a little too fancy. I wanted something simple to copy/paste from and Visual.Syntax won the day for me. iG:Syntax Hiliter is a close second and I may still use it some day. It does neat things like line numbering and highlighting for a large amount of languages; but I did not find it as simple to use as Visual.Syntax. In case you were wondering, both of them work with WordPress 2.x.
Categories: Code Samples,Site Updates
Tagged: Matthew Delmarter
- Published:
- September 10, 2006 – 5:44 pm
- Author:
- By Dave
Considering that I plan on using a lot code on this site, I put a lot of thought into the best fonts to use for readability. I ended up going by a programmers font guide from Mr. Lowing. The code highlights on these pages use the following fonts (in order of preference/availability): Bitstream Vera Sans Mono, Lucida Console, Consolas, Courier, monospace. The result is below: 123456<?php if ( ! validate_username($user_login) ) { $errors['user_login'] = __(‘This is what the code looks like highlighted’); $user_login = ”; } ?> If everything went right, it should look like one of the following: If you do not have one of those fonts, you should still see a monospaced font.
Categories: Site Updates
Tagged: Lowing, PHP, Vera Sans Mono
- Published:
- September 10, 2006 – 4:39 pm
- Author:
- By ddrager
Welcome to the inaugural post of systemBash.com! I created this site mainly for myself, as a repository for different system administration and code snippets for future reference and posterity. I aim to keep it keep the code clean, but easy to read (and search for). I’ll also be posting short reviews of different software suites for anyone happening across this site or looking for more info.
Categories: Site Updates
Tagged: software suites