Tuesday, September 27, 2011

Simulating slow network connection in OSX

Setup
sudo ipfw pipe 1 config bw 16Kbit/s delay 350ms

sudo ipfw add 1 pipe 1 src-port 80
sudo ipfw add 2 pipe 1 dst-port 80


Remove
sudo ipfw delete 1
sudo ipfw delete 2

sudo ipfw pipe 1 delete

Wednesday, September 21, 2011

Disable spotlight

Disable Spotlight
sudo mdutil -a -i off

Enable Spotlight
sudo mdutil -a -i on

Tuesday, September 20, 2011

Tapping on <label> in Mobile Safari

Tapping on <label> does not auto-focus linked in Mobile Safari but If we add an empty function as clickhandler it works fine.

<input type="checkbox" id="test" name="test">
<label for="test" id="test_label">This is the label</label>
<script>
document.getElementById("test_label").onclick = function () {};
</script>

This is the releated Stackoverflow discussion.

Thursday, September 8, 2011

Checkbox/Radio button size on Android Safari

You cannot change checkbox/radio button width/height on Android in Safari because it is tied to the OS.

But since the default ones are so tiny that you may need bigger buttons.
Here is a simple trick:

input[type=checkbox] {
-webkit-transform: scale(2,2);
}

Please note that if you set up values bigger than ~2 then the yellow outline will look weird.