mahiwaga

I'm not really all that mysterious

OS Timeline Updated

Updated from 2008

</tr> </table> </div>
  2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015
Windows XP     Vista 7 8 8.1 10
Mac OS X
  • 10.0 "Cheetah"
  • 10.1 "Puma"
  • </td>
10.2 "Jaguar" 10.3 "Panther"   10.4 "Tiger"   10.5 "Leopard"   10.6 "Snow Leopard" 10.7 "Lion" 10.8 "Mountain Lion" 10.9 "Mavericks" 10.10 "Yosemite" 10.11 "El Capitan"
Red Hat Linux/Fedora
  • 7.1 "Seawolf"
  • 7.2 "Enigma"
  • 7.3 "Valhalla"
  • 8 "Psyche"
  • 9 "Shrike"
  • Fedora Core 1 "Yarrow"
  • Fedora Core 2 "Téttnang"
  • Fedora Core 3 "Heidelberg"
Fedora Core 4 "Stentz"
  • Fedora Core 5 "Bordeaux"
  • Fedora Core 6 "Zod"
  • Fedora 7 "Moonshine"
  • Fedora 8 "Werewolf"
  • Fedora 9 "Sulphur"
  • Fedora 10 "Cambridge"
  • Fedora 11 "Leonidas"
  • Fedora 12 "Constantine"
  • Fedora 13 "Goddard"
  • Fedora 14 "Laughlin"
  • Fedora 15 "Lovelock"
  • Fedora 16 "Verne"
  • Fedora 17 "Beefy Miracle"
  • Fedora 18 "Spherical Cow"
  • Fedora 19 "Schrödinger's Cat"
  • Fedora 20 "Heisenbug"
Fedora 21 Fedora 22
posted by Author's profile picture mahiwaga

Know from Whence You Came

Know from whence you came. If you know whence you came, there are absolutely no limitations to where you can go.

James Baldwin

(crossposted on Tumblr)

posted by Author's profile picture mahiwaga

serious geekery revisited

I just ran into this old post about idioms rewritten in computer (pseudo)code. It occurs to me that I’ve learned a lot more Ruby since then, and I decided to rewrite some of the pseudocode into actual code.

  1. original:
    // idiom 1  
    
    cop[0].goodInPercent = 100;  
    cop[1].goodInPercent = 0;  
    my version:
    class Interrogation  
    
      @Interrogators=[]  
      
      def GoodCopBadCop  
        @Interrogators=[cops.select { |cop| cop.is_good? }.first, cops.select { |cop| cop.is_bad? }.first]  
        cops.delete(cops.select { |cop| cop.is_good? }.first)  
      end  
    end  
  2. original:
    // idiom 2  
    
    isCrowd = personCounter >= 3;
    my version:
    class Fixnum  
      def is_crowd?  
        self > 2  
      end  
    end  
    
    3.is_crowd?
  3. original:
    // idiom 3  
    
    injury += insult;
    my version:
    return (insult + injury)
  4. original:
    // idiom 4  
    1: board.draw();  
    goto 1;
    my version:
    session[:return_to] ||= 'http://http://mahiwaga.net/drawing-board'  
    redirect_to session.delete(:return_to)
  5. original:
    // idiom 5  
    
    if (bird[1].feather == bird[2].feather) {  
        bird[1].flock(bird[2]);  
    }
    my version:
    flock.collect {|bird| feathers.each {|feather| bird.find_by_feather(feather)}}  
  6. original:
    // idiom 6  
    
    a = getThickness('blood');  
    b = getThickness('water');  
    assert(a > b);  
    class Liquid  
      attr_accessor :spec_grav  
    
      def initialize args  
    	 args.each do |k,v|  
    	   instance_variable_set("@#{k}", v) unless v.nil?  
    	 end  
      end  
      
      def is_thicker_than?(other_liquid)  
        self.spec_grav > other_liquid.spec_grav  
      end  
    end  
    
    blood = Liquid.new(:spec_grav => 1.0506) # reference: http://www.clinchem.org/cgi/content/abstract/20/5/615  
    
    
    water = Liquid.new(:spec_grav => 1.0000)  
      
    blood.is_thicker_than?(water)  

    (see: Specific Gravity of Blood and Plasma at 4 and 37°C)

  7. original:
    // idiom 7  
    
    a_spade_a_spade();
    my version:
    class Spade    
      def call(value)   
        @name = value  
      end  
    end  
    
    spade=Spade.new  
    spade.call("a spade")  
  8. original:
    // idiom 8  
    
    die(1000);  
    function die(max) {  
        for (i = 1; i <= max; i++) {  
            cut();  
        }  
    }
    my version:
    Death.find_by_cut('1000')
  9. original:
    // idiom 9  
    
    prey = 'worm';  
    time = getCurrentTime();  
    if (time >= 4 && time <= 8) {  
        bird.catch(prey);  
    }  
    my version:
    bird = Creature.new(:shift => 'early')  
    worm = Creature.new  
    if bird.shift == 'early'   
      bird.catch(worm)  
    end  
  10. original:
    // idiom 10  
    
    while ( rome.fire() ) {  
        doFiddle();  
    }
    my version:
    Nero(:instrument => 'fiddle') while Rome.is_burning?  
  11. original:
    // idiom 11  
    
    function getValue(garbage) {  
        return garbage;  
    }
    my version:
    Value.In(:Garbage)  
    print Value.Out    
    ==>Garbage  
  12. original:
    // idiom 12  
    
    take(salt * .01);
    my version:
    Salt.take(:mass => 0.06479891, :unit => 'gram')  
  13. original:
    // idiom 13  
    
    var here = false;  
    var there = false;
    my version:
    !(here or there)  
  14. original:
    // idiom 14  
    
    if (i == 2) {  
        tango();  
    }
    my version:
    def self.takes(value)   
      if value == 2 then self.tango;  
    end  
  15. original:
    // idiom 15
    
    days = 365;  
    for (day = 1; day <= days; day++) {  
        if ( random(0,100) <= 50 ) apple++;  
    }  
    if (apple <= days) doctor();  
    my version:
    year.collect {|day| if day.apples.count > 0 then doctor.keep_away}  
  16. original:
    // idiom 16  
    
    if ( !dogs.sleep() ) {  
        disturb(dogs);  
    }  
    my version:
    if dog.is_asleep?  
      dog.lay  
    end
  17. original:
    // idiom 17
    
    function tunnel() {  
        var dark;  
        for (i = 0; i < 10; i++) {  
            dark = true;  
        }  
        dark = !dark;  
        return dark;  
    }
    my version:
    Class Tunnel   
      def self.is_there_light?   
        return (self.position == 'END')  
      end  
    end  
  18. original:
    // idiom 18  
    
    if ( ape.inLineOfSight(it.x, it.y) ) ape.do(it);
    my version:
    if monkey.does_see?(:actor)  
      monkey.do(Monkey.action_seen(:actor))  
    end
  19. original:
    // idiom 19  
    
    return way.my || way.high;
    my version:
    return way(:my) || way(:high)  
  20. original:
    // idiom 20  
    
    hay[ random(0, hay.length - 1) ] = 'needle';  
    my version:
    hay = Stack.new  
    hay.find('needle')  
  21. original:
    // idiom 21  
    
    a = 0;  
    b = 1;  
    hand[a].wash(hand[b]);  
    hand[b].wash(hand[a]);  
    my version:
    hand['left'].wash(hand['right'])  
    hand['right'].wash(hand['left'])  
  22. original:
    // idiom 22  
    
    function getGain(pain) {  
        return pain >= 1;  
    }
    my version:
    if (pain.level == 0) then gain.level = 0  
  23. original:
    // idiom 23  
    
    if (cooks >= 3) {  
        broth = null;  
    }
    my version:
    class Broth  
    
      def is_spoiled?  
        self.cook.count >= TOO_MANY  
      end  
    end
  24. original:
    // idiom 24    
    
    if (a != 'cake') a.eat();  
    my version:
    Class Cake  
      def Cake.have()    
        Cake.is_had? = Cake.is_eaten? ? false : true    
      end   
    
      def Cake.eat()   
        Cake.is_eaten? = Cake.is_had? ? false : true  
      end  
    end
  25. original:
    // idiom 25  
    
    doesStand = you == me;
    my version:
    if We.is_united? then We.stand()  
    if We.is_divided? then We.fall()  
  26. original:
    // idiom 26  
    
    var location = getLocation();  
    if (location == 'rome') {  
        do( location.getCitizen() );  
    }
    my version:
    if person.locale == 'Rome'  
      person.behavior(:Roman)  
    end
posted by Author's profile picture mahiwaga