So, the code is like 15 lines and tossed together (currently using both Kernel.rand and Random, which is silly) — but I'd love ideas on how to make it better, how else to encourage unpredictable or more "human" behavior, other libs, etc!
When I think about creating lifelike responses, I tend to think of action potentials. Have a counter which tends to decay toward zero over time. When you attempt to do something, nudge the counter upwards. When the counter exceeds some threshold, do some behavior and the clear the counter. Note that this kind of mechanism is inherently stateful.
That said, I think that incorporating randomness or hidden variables into a user interface is rather misguided. Making a system harder to reason about takes control away from the user- it's basically an even more severe version of the problems with "Do What I Mean" in general.
I like that "action potential" idea – I was trying to think of a good implementation for "do something twice a month per user" — decaying counter is a nice idea.
I'm with you on willy nilly making parts of your UI random — my use case is for changing up the text in greetings, general play with copy, and once in a while showing something like a tip or a "welcome back" message. Basically, small touches that convey a small sense of variety (vs. RANDOMLY DONT SHOW THE NAV!)
For printing varied text strings, what I've done is allow entries in the string table to have multiple text strings rather than just one. So if the code asks for the string GREETING, for example, rather than the string table code getting this one and only text for GREETING ("hello", say), it randomly picks one from the set (you might have "hello", "hi", "good day", perhaps).
Then whoever looks after the wording can just add as many strings as they like, for any messages they think could do with some variety. No forward planning required, because the code to do this is centralized, so it works for any string.
The problem with using Random for displaying nice touches and reminder notices is that, well, it's random. It won't take very long for a user to get a rare and annoying "Have you thought about upgrading?" (or similar) message three times in a row, at which point they're likely to get annoyed.
I wouldn't worry about the implementation too much since, as you say, it is really very little code and easy for anyone to code up themselves.
What is awesome about what you've done is the idea and the interface. I'd focus on expanding that with more interesting use cases. For example it would be cool if this hooked more neatly into rails localization where I could say something like:
= t('some_set_of_possible_stuff.*')
Or whatever. I agree with the other poster who states it makes your app more hard to test however that is not a good enough reason to not do something by itself. It just means you need to be measured in how and where you do it and careful. In the right app, the value to the end user experience wrt personalization is super high so it is worth it.
Good point. I considered doing this, but then it ends up being a "surprise" to users when they quickly go to triple-click (select all) and the interaction is different than expected.
What I find really useful is you can immediately type some characters to filter, and then tab to the command you want. It's automatically selected in that case.
I'll likely stick a "copy" button on hover shortly — had some initial problems with z-indexes (it uses flash) but this solves the "one click to copy" issue without affecting the default and expected interaction.
This is a great reply. "On the fly" is definitely my experience too. Needing to do something. Doing things slowly, inefficiently, with googling until you find or get told the more efficient way of doing things.
Also, talking with/demanding explanations/debating with geekier than thou friends has been really helpful with the bigger concepts.
Learning by doing is probably the way most people learn their unixcraft. It also helps if you have a friend or a team member who is a lot more experienced than you, a go-to guy with infinite patience to your stupid questions.
I had the privilege of working with a badass russian unix hacker for some time, he taught me how to do black magic with find, grep, sort and uniq.
Ack! I'm sorry! I started out with "pre" elements, but they were causing problems with copying and pasting (it looked odd, and it added a dreadful newline so the command would execute on paste!)
The plan is to have a pdf shortly; that will most definitely be copy and pasteable.