Tags
array bash benchmark cli compose compose key configuration css diy editorial firefox fixes gotcha hack hardware html5 input javascript jquery jsperf keyboard linux mouse multi touch multitouch nginx opera performance preferences prototype ruby sameheight snippet special characters ssh style syntax touchpad touch pad trackpad track pad ubuntu w3c web standards wiiCategories
-
Recent Posts
Recent Comments
- Lashell on Defining Functions Inline Is Just Fine
- Christian Iversen on JavaScript Performance: Iterating over Arrays with Holes
- force on JavaScript Performance: Iterating over Arrays with Holes
- Christian Iversen on JavaScript Performance: Iterating over Arrays with Holes
- force on Delete a Line from a File by Its Line Number
Archives
Meta
Author Archives: force
Clone Ubuntu VMs in VirtualBox
I installed Ubuntu from mini.iso and I want to make several copies. What are the potential pitfalls? Well, the only real problem is that if we’re not careful they’ll all have the same MAC address. There’s a checkbox to avoid … Continue reading
Depaginate Phoronix Articles
I sketched this for Phoronix, but you could easily adapt it to any site that uses pagination. I think it’s an interesting problem, so if you want to see another site depaginated, just ask me in a comment and I’ll … Continue reading
Posted in javascript, quickies
Tagged depaginate, depagination, javascript, jquery, paginate, pagination, phoronix, plugin, user script
Leave a comment
Dropbox: Unable to monitor filesystem
Have you seen this while using Dropbox in Linux? Unable to monitor filesystem Please run: echo 100000 | sudo tee /proc/sys/fs/inotify/max_user_watches and restart Dropbox to correct the problem. Apparently, Linux is imposing some kind of default restriction of the number … Continue reading
extconf.rb:4:in `require’: no such file to load — mkmf (LoadError)
I’ve hit this a dozen times and I always forget the solution. When you get this on Ubuntu, sudo apt-get install ruby-dev
ssh Through Two Hosts in One Command
Say you want a shell on a box but you have to hop through another box to get it. force@harold:~% ssh admin@maude maude:~ force$ ssh root@whee root@whee:~$ echo w00t w00t You can do that in one line using -t (pseudo-tty … Continue reading
JavaScript Performance: Iterating over Arrays with Holes
I was sketching some code that basically took some data from a database and cached it in an array to be repeatedly reused. Conveniently, each row from the database had a unique ID, so I could use that as an … Continue reading
Posted in javascript, Uncategorized
Tagged array, benchmark, hole, iteration, javascript, jsperf, loop, undefined
3 Comments
Defining Functions Inline Is Just Fine
I put together this jsperf to see if there’s a difference between defining your function and then using it or defining it inline when looping with jQuery.each. You can try it yourself if you like, but here are the results: … Continue reading
Show Duplicate Filenames with Ruby
Here’s a quick one. I want to show just the names of files that have the same basename in a directory. Code require ‘find’ require ‘set’ all_files = [] duplicates = {} basenames = Set.new ARGV.each do |dir| Find.find … Continue reading
Ruby instance_eval gotcha
I don’t know how much of a “gotcha” this is since it’s just a defined behavior and feature of the language, but I still found it a little counterintuitive when I encountered it, and I had to actually read the … Continue reading
JavaScript Strings: instanceof vs. typeof
I’ve discovered some really interesting (read as “horrible”) behavior in Safari 5 and Internet Explorer 9. I was using this with great success in Chrome and Firefox. if (typeof this === ‘string’) { doStuffWith(this); } Then I test … Continue reading
Posted in javascript
Tagged bug, chrome, firefox, gotcha, ie9, instanceof, internet explorer, javascript, quirk, savari, string, strings, typeof
Leave a comment