Stable sort
c.f. ruby-talk 133930class Array def stable_sort n = 0 sort_by {|x| n+= 1; [x, n]} end end
TextSnippets > ruby >
Post code snippets. Sort by tags, people, people and tags, etc..
Top Associated Tags
26 | ruby | |
+ | 16 | rails |
+ | 6 | lighttpd |
+ | 4 | error |
+ | 2 | fastcgi |
+ | 2 | |
+ | 2 | osx |
+ | 2 | textdrive |
+ | 2 | dispatch.fcgi |
+ | 2 | typo |
+ | 2 | tiger |
+ | 1 | daedalus |
+ | 1 | setup |
+ | 1 | crontab |
+ | 1 | wordpress |
+ | 1 | fixtures |
+ | 1 | on |
+ | 1 | darwinports |
+ | 1 | darcs |
+ | 1 | xmlrpc |
+ | 1 | awk |
+ | 1 | sessions |
+ | 1 | ruby-fcgi |
+ | 1 | launchd |
+ | 1 | config |
+ | 1 | md5 |
+ | 1 | maintenance |
+ | 1 | rubyonrails |
+ | 1 | sort |
+ | 1 | rake |
+ | 1 | nice |
+ | 1 | shell |
+ | 1 | reboot |
+ | 1 | rubilicious |
+ | 1 | calendar |
+ | 1 | php |
+ | 1 | processes |
+ | 1 | helper |
+ | 1 | vcs |
+ | 1 | del.icio.us |
+ | 1 | exception |
+ | 1 | tmp |
+ | 1 | password |
+ | 1 | lingon |
Top Users
52 | nothingless |
26 | jason |
15 | rsimplicio |
14 | ubernostrum |
10 | jacques |
10 | soul |
6 | kjell |
6 | jimray |
6 | dean |
6 | bcrow |
5 | rubymatt |
5 | johnt |
5 | vixx |
4 | jason2 |
4 | unquiet |
4 | nickstenning |
4 | yetsirah |
4 | dasil003 |
4 | quidire |
4 | purplefeet |
4 | incognito |
3 | metafeather |
3 | christopher |
3 | joshpeek |
3 | ryan |
3 | tikki |
3 | tim |
3 | ludo |
3 | Q2Developers |
3 | Sencer |
3 | danb |
2 | kchrist |
2 | cnladd |
2 | miraclebaby |
2 | joeldueck |
2 | aaron |
2 | gregf |
2 | Nis |
2 | Hans |
2 | julik |
2 | wazungu |
2 | jblomberg |
2 | jtnt |
2 | hil |
2 | ubs |
2 | shoesobjects |
2 | marten |
2 | jacob |
2 | Andy |
2 | cch |
? Earlier | 1 items total | Later ? |
class Array def stable_sort n = 0 sort_by {|x| n+= 1; [x, n]} end end
? Earlier | 1 items total | Later ? |
Developed by Peter Cooper and powered by Ruby On Rails