-
smaller than an animated gif.
-
python phone number formatting library
Liked what you read? I am available for hire.
Liked what you read? I am available for hire.
Liked what you read? I am available for hire.
Liked what you read? I am available for hire.
I like to shuffle poker chips while I work. It gives me something to do while pages are loading or while I'm thinking that doesn't involve checking Twitter or Hacker News.
I got curious how long it took for chip stacks of various heights to return to their shuffled state. However right now I can only shuffle stacks of 18 chips (9 red, 9 blue) before they come tumbling back to the floor, out of my hand. So I wrote a short program to simulate chip shuffles and determine how long it would take to get the stacks back to their shuffled state.
Here are the results:
Number of Red Chips Total Shuffles 1 2 2 4 3 3 4 6 5 10 6 12 7 4 8 8 9 18 10 6 11 11 12 20 13 18 14 28 15 5 16 10 17 12 18 36 19 12 20 20
That's a pretty interesting pattern. I'm sure there's a bunch of cool math behind it; I'll look it up soon and then update this post if I find any. Note that if the number of shuffles is divisible by two, the chips reverse order in the stack (ex. go from all red on the bottom to all red on the top) before returning to their original state.
Update: I found the pattern behind the poker chip shuffle sequence, on a site that lets you plug in any integer sequence and try to find the pattern that matches. You can find the pattern here. Glad I found that page, because I'm not sure I would have guessed the pattern. Here is more detail:
In other words, least m such that 2n+1 divides 2^m-1. Number of riffle shuffles of 2n+2 cards required to return a deck to initial state. A riffle shuffle replaces a list s(1), s(2), ..., s(m) by s(1), s((i/2)+1), s(2), s((i/2)+2), ... a(1) = 2 because a riffle shuffle of [1, 2, 3, 4] requires 2 iterations [1, 2, 3, 4] -> [1, 3, 2, 4] -> [1, 2, 3, 4] to restore the original order.
Here's the example code, in Haskell:
To output numbers, save that code as a file calledchips.hsand run:
$ ghci GHCi, version 6.10.4: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer ... linking ... done. Loading package base ... linking ... done. Prelude> :l chips.hs [1 of 1] Compiling Main ( chips.hs, interpreted ) Ok, modules loaded: Main. *Main> zip [1..20] (map getNumberOfShuffles [1..20])
Liked what you read? I am available for hire.
Liked what you read? I am available for hire.
Liked what you read? I am available for hire.
Liked what you read? I am available for hire.
tl;dr Every company needs an internal URL shortener. Your new employees will thank you later.
You just started your new job, and you've got a million things to learn about, but never enough time to do them all. You want to sign up for a massage to take some of the stress off. But where do you sign up for massages? You can bug a coworker for the URL but they're busy too, and you're already bugging them 20 times a day about more important stuff. Alternately, you could search through the poorly documented company wiki. The page you find is probably out of date, but no one will tell you that the massage page moved 6 months ago.
The third option, and by far the best, is to punch massage
into your
company's URL shortener and get taken straight to the massage page. Once you've
done this a few times and gotten success, you'll realize the power of it. And
if you try the shortener and don't get any results, you get a form asking you
to add the URL you do find, for the next new person who might come along.
This is so helpful; you don't have to bookmark useful pages when you find
them, or search through your history to find that really useful Perforce setup
tutorial you only got halfway through.
Instead the URL shortener takes care of all of it. At Google you just type
go/
followed by the name of whatever you're looking for, like go/massage
or
go/coffeescript
. Curious about what the Google+ team is working on? Type in
go/emeraldsea
. If you don't get what you're looking for, you add it for the
next person. This way Google's spaghetti mess of internal wiki software becomes
manageable, and good resources never go missing. Another benefit is people can
share links on ads and in talks very easily - just tell people the shortcut
URL, which they're much more likely to remember than a full URL.
So stop worrying about keeping your website organized and get a URL shortener. If your documentation becomes deprecated, just make a new page and update the shortlink. It's not very hard to set up and it will help your new employees get up to speed faster.
To ensure you have no excuse, I wrote a minimum viable URL shortener over the last two nights. Check it out and contribute features. I hope your company will experience enlightenment soon.
Liked what you read? I am available for hire.
Liked what you read? I am available for hire.
Liked what you read? I am available for hire.