Google Chrome and 1Password
The new Google Chrome Beta for mac and the alpha 1Password extension work perfectly together!
The new Google Chrome Beta for mac and the alpha 1Password extension work perfectly together!
-webkit-box-shadow (in Webkit nightly) and -moz-box-shadow support inner shadows with the inset keyword. Both also support multiple shadow declarations separated by commas.
Want to achieve the box pictured above?
div.box { -webkit-box-shadow: 0 3px 3px rgba(0,0,0,0.20), rgba(0,0,0,0.12) 0px 0px 10px inset; -moz-box-shadow: 0 3px 3px rgba(0,0,0,0.20), rgba(0,0,0,0.12) 0px 0px 10px inset; -webkit-border-radius: 10px; -moz-border-radius: 10px; border: 1px solid #fff; padding: 6px; width: 200px; background: #fff; }
There’s a very convenient shell script bundled with some distributions of OpenSSH called ssh-copy-id. It seems not to be the case with Leopard’s SSH.
In order to get it, we can simply check it out of a SVN repository. Execute this two commands:
sudo curl "http://www.chiark.greenend.org.uk/ucgi/~cjwatson/cvsweb/openssh/contrib/ssh-copy-id?rev=1.8;content-type=text%2Fplain" -o /usr/bin/ssh-copy-id sudo chmod +x /usr/bin/ssh-copy-id
And you’re done!

Not a big fan of the Web Developer toolbar? Me either! But I do use the logging system quite a bit. Thankfully, OS X ships with an useful application called Console that comes to the rescue.
frontend_dev.log or desired log file in the symfony logs directoryShow Log List and select your newly opened file to avoid the clutter of the rest of the OS logsI just discovered a gem called etckeeper, which I’m sure will change the way we’re used to work with server configurations.
The official website describes it pretty well:
etckeeper is a collection of tools to let /etc be stored in a git, mercurial, darcs, or bzr repository. It hooks into apt (and other package managers including yum and pacman-g2) to automatically commit changes made to /etc during package upgrades.
All it took me to set it up on my Debian Lenny slice was:
$ aptitude install etckeeper # aptitude will install Git as the version control system, which is pretty neat! $ cd /etc/ $ sudo etckeeper init -m "initial commit" Initialized empty Git repository in /etc/.git/
The best part is that it’ll detect changes made by apt, commit whatever changes you had made previously, and even enable you to make your own commits, after your manual modifications. Do try it out!
If you upgraded to PHP 5.3, chances are high you’re going to run into a few warnings or deprecated function messages.
An example is the ereg family of functions, which are gone for good, as they were slower and felt less familiar than the alternative Perl-compatible preg family.
To migrate ereg():
ereg('\.([^\.]*$)', $this->file_src_name, $extension);
becomes
preg_match('/\.([^\.]*$)/', $this->file_src_name, $extension);
Notice that I wrapped the pattern (\.([^\.]*$)) around / /, which are RegExp delimiters. If you find yourself escaping / too much (for an URL for example), you might want to use the # delimiter instead.
To migrate ereg_replace():
$this->file_dst_name_body = ereg_replace('[^A-Za-z0-9_]', '', $this->file_dst_name_body);
becomes
$this->file_dst_name_body = preg_replace('/[^A-Za-z0-9_]/', '', $this->file_dst_name_body);
Again, I just added delimiters to the pattern.
If you are using eregi functions (which are the case-insensitive version of ereg), you’ll notice there’re no equivalent pregi functions. This is because this functionality is handled by RegExp modifiers.
Basically, to make the pattern match characters in a case-insensitive way, append i after the delimiter:
eregi('\.([^\.]*$)', $this->file_src_name, $extension);
becomes
preg_match('/\.([^\.]*$)/i', $this->file_src_name, $extension);
wp-content/themes/smilies-themer/. In my case I called it devthoughtPlace your emoticons in that folder and a file called package-config.php
Place a code like this in package-config.php
<?php /* * Package-Name: Theme name * Package-URI: http://yourwebsite.com * Package-Description: Your theme description * Package-Author: Your name * Package-Author-URI: http://yourwebsite.com */ $wp_smilies = array( '>:o' => 'angryface.png', '>:-O' => 'angryface.png', ':-[' => 'blush.png', ':[' => 'blush.png', ); // add as many as you want respecting the same format: // 'emoticon' => 'file.jpg',
Now you’re done!
:[ >:o
:X :-/
o:)
This is a quick idea I came up with. We extend the Event native like this:
Event.implement({ hasCapsLock: function(){ return ((this.code > 64 && this.code < 91 && !this.shift) || (this.code > 96 && this.code < 123 && this.shift)); } });
And then access the method from a keypress event:
$('test').addEvent('keypress', function(event){ if (event.hasCapsLock()){ // do something } });
The only drawback is that it relies on sniffing alphabet characters and whether the shift key was pressed. This means that if the user presses the caps lock key, you won’t know it until another character is inserted.
The default shell for Leopard users is Bash. Although many GNU/Linux users are familiar with it, not all Mac users take full advantage of its power. Here are some very useful commands and tips I use routinely.
Use the root superuser
sudo su -
Alter login variables (such as $PATH, $EDITOR)
nano ~/.profile
Other available shells
Output the contents of a file
cat /some/thing
Get 20 lines from the end of a file
tail -n 20 /some/thing
Get the first 20 lines of a file
head -n 20 /some/thing
Create an empty file
touch /some/thing
Redirect the output of a command to a file (overwrites)
command > /some/thing
Redirect the output of a command to a file (appends)
command >> /some/thing
Append the timestamp to a file
touch /backups/backup_`date +%s`.txt
Change to the last directory you were in
cd /var cd /etc cd - # will take you to /var
List file size in human-readable units
ls -lh /dir/or/file
Available editors
Run a process in the background
command &
List running processes
ps axThe first column will be the PID
Kill a process by pid
kill -9 <pid>
Kill a process or processes by name (e.g: the Dock)
killall DockOpen an application (Mac-only)
open /Applications/iTunes.app/