Kiwi Gardner

[youtube &w=640&h=360] Reminds me of my golden days, hahaha… ;)

March 3, 2012 · 1 min · birdchan

Use PHP to remove non ascii characters

Yea, sometimes it’s acceptable and you will need to do this. $s = "Don't you love this ☂?"; $s = preg_replace('/[^(x20-x7F)]*/','', $s); The string becomes Don't you love this ? Thanks Ryan for figuring this out!

March 1, 2012 · 1 min · birdchan

jeditable textile having no OK nor cancel button

Say in implementation the jeditable textile you don’t want any OK nor Cancel buttons, kinda like making your textarea an Excel cell, how to do that? The key is to use onblur, then comment out submit and cancel. Now when you press ESC, it’s a cancel. Clicking somewhere else is an OK, or submit. $('.editable_textile').editable('save.php', { indicator : '', loadurl : 'load.php', type : 'textarea', onblur : 'submit', //submit : 'OK', //cancel : 'Cancel', callback: function(value, settings) { var retval = value.replace(/\n/gi, " \n"); $(this).html(retval); }, }); See more examples at http://unrealideas.net/examples/05_onblur.php ...

February 29, 2012 · 1 min · birdchan

"You have new mail" on osx

Sometimes when I open up a new terminal I see the following, notifying me there are new mails in my system mail box. Last login: Tue Feb 28 18:57:43 on ttys006 You have new mail. Just how to read those emails? You can use “mailx”. my_osx_box:~ birdchan$ mailx This is a very linux like mail program, so don’t expect fancy controls. Below are some commands that are enough to get you through. ...

February 29, 2012 · 1 min · birdchan

Mysteriously off-by-1 pixel even using width=100% ???

This took me a while to debug, one div and one fieldset both are set to 100%, but in close examination they are off by a few pixels. Below is a stripped down example. This is the menu bar, with some buttons Some text So, I was like, perhaps some of these jquery-ui classes gave margin values, so I manually set the margins to all zeros. I also then set all the border sizes to zeroes. ...

February 28, 2012 · 1 min · birdchan

Adding css box shadow

CSS really made adding shadow easy and fun! .my_shadow { -moz-box-shadow: 0 0 5px 5px #888; -webkit-box-shadow: 0 0 5px 5px #888; box-shadow: 0 0 5px 5px #888; } hello All you are adding is the following style code. Then assign the my_shadow class to your box. .my_shadow { -moz-box-shadow: 0 0 5px 5px #888; -webkit-box-shadow: 0 0 5px 5px#888; box-shadow: 0 0 5px 5px #888; } I remember back in the days it was painful to use images surrounding the box… haha, we have come a long way… ;) ...

February 28, 2012 · 1 min · birdchan

How to free up osx RAM

I think I found the easiest way ever in my whole history of using osx to free up ram. Well, of course I am talking about using a free app. ;) Here it is. It’s rightfully called FreeMemory and you can download it from the Mac App Store. With it, you no longer need to manually check your Activity Monitor, close apps, relaunch… Once you launch the app, it will display your current free memory amount on your top bar. When you need to free up some memory, just click on the app on the top bar, then click “free memory”. That’s it! ...

February 28, 2012 · 1 min · birdchan

2012年2月21日 - 星期二檔案 婚價

[youtube &w=640&h=360] [youtube &w=640&h=360]

February 25, 2012 · 1 min · birdchan

jeditable textile textarea renderer issue

If you have ever played with jeditable, eventually you will get to this issue, which is dealing with the textarea. The Textile renderer on the official jeditable demo page works perfectly fine, but when I tried it I experienced quite some difficulty. Basically the text I enter would NOT be what I see after pressing the ok button, due to the html rendering of the newline character. I found a lot of people sharing their pain all over the internet: ...

February 25, 2012 · 2 min · birdchan

香港政壇

February 24, 2012 · 0 min · birdchan