ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Let's compile a list of funny CI code snippets

February 03, 2008 12:01pm

Subscribe [5]
  • #1 / Feb 03, 2008 12:01pm

    BoltClock

    59 posts

    Basically we rummage in CI’s source code for any funny, interesting or weird snippets of code and post them here to show that we developers and programmers do throw some humor into our work 😊

    For example, I was just looking at the Loader’s source code when I found this in CI_Loader::model():

    <?php
    
    // ...
    
            if (is_array($model))
            {
                foreach($model as $babe)
                {
                    $this->model($babe);    
                }
                return;
            }
    
    // ...
    
    ?>
  • #2 / Feb 14, 2008 4:04am

    Lone

    350 posts

    Always a good laugh that one 😛

    Just came across this the other day from index.php:

    /*
    |---------------------------------------------------------------
    | LOAD THE FRONT CONTROLLER
    |---------------------------------------------------------------
    |
    | And away we go…
    |
    */


    And this one in the standard humans library

    class Humans {
    
      function Humans()
      {
        $this->kill_all();
      }
    
      function kill_all()
      {
        $this->db->where('human', 1);
        $this->db->delete('users'); 
      }
    }

    No idea who would have done this 😛

  • #3 / Feb 15, 2008 4:57am

    BoltClock

    59 posts

    That famous (or not?) ‘away we go’ line. I love it.

    And what is this Humans library that you speak of? 😛

  • #4 / Feb 15, 2008 2:02pm

    Derek Allard

    3168 posts

    I like the table library.

    // Is there anything to display?  No?  Smite them!

    In truth, we try to avoid too many funny refs in there.  Derek Jones even talked me out of my Prince reference that I had in the db library after he helped out with a particularly thorny regex.  I now share it here for all the world

    // So this is what it feels like when doves cry…

  • #5 / Feb 15, 2008 3:30pm

    Derek Jones

    7561 posts

    Difficult as it may be, we try to keep comments in CodeIgniter for the most part neutral.  ExpressionEngine, however, is another story.

  • #6 / Feb 15, 2008 5:05pm

    Lone

    350 posts

    Haha good to see some humour still in coding - Ill have to look through your life story in EE then 😛

  • #7 / Feb 16, 2008 7:57am

    BoltClock

    59 posts

    Just wondering, why exactly do you try to avoid funny comments?

  • #8 / Feb 16, 2008 10:41am

    Derek Allard

    3168 posts

    Just trying to keep the level of professionalism high.  Its not that funny code comments are necessarily unprofessional, its just that we try to keep in a “strictly code” mindset when we work with CI so as to deliver the most stable, fast, comprehensive code possible.

  • #9 / Feb 16, 2008 11:35am

    Majd Taby

    637 posts

    Just picked this up from Pagination.php (while trying to make it take an extra parameter to specify a uri_assoc_key..anyway)

    // Determine the current page number.      <br />       $CI =& get_instance();  <br />       if ($CI->uri->segment($this->uri_segment) != 0)<br />       {<br /> $this->cur_page = $CI->uri->segment($this->uri_segment);<br /> <br /> // Prep the current page - no funny business!<br /> $this->cur_page = (int) $this->cur_page;<br /> }

  • #10 / Feb 16, 2008 11:50am

    Seppo

    483 posts

    The image lib has secrets…

    // If the target width/height match the source then it's pointless to crop, right?
                // So if dynamic output isn't on, then we'll return true so the user thinks
                // the process succeeded. It'll be our little secret…
    
                if ($this->width >= $this->orig_width AND $this->height >= $this->orig_height AND $this->dynamic_output !== TRUE)
                {
                    return TRUE;
                }
  • #11 / Feb 16, 2008 11:21pm

    BoltClock

    59 posts

    OK I get you Derek. Especially for code comprehensibility.

  • #12 / Feb 16, 2008 11:29pm

    tobben

    94 posts

    I really hope that CodeIgniter 1.7 will be released with comments containing knock-knock jokes, funny IRC quotes, Star Trek quotes and ASCII-porn.

    That would make my day.

  • #13 / Feb 17, 2008 12:17am

    Derek Jones

    7561 posts

    Does this count?

    Knock Knock

    Who’s There?

    /me

    ;@@@$@@@@@@@@@@#N#@NN@@@$8@@@$@@@#@N@NNNN@#
                     :?*88N@@@@@@@#@@8             "@@@@@@@@NNNNNN#@#X#@@N@@@@@@##@
    ""/N88S#@@@@@@@@@@@@#@N@@N#@N8".                  '8@@@@$N#N$@@@NN@@@N#@@@##@@@
    8N#@88N@NX8NNNNNNNN#8N8N$NS-                           "@@@@NN#N@@##@@@@@@@@@@@
    8NNNN8NNNNNN#N#NN##NXSNN8'                      '.       ;@@@@@@@#@@@@N@@@@N@@@
    N$NNNNNN###N#@N$$8888I?                    .  --.++++   . .'?@@@@N@@@@#@@@@@@@@
    88NN88X#$$8N88N$8X$$I:                      +.  ..+;::++::++' :@@@@@@NO;:      
    88X$X88888X$X88SX8?                       .'-''+-=+:""""";:+ .                 
    XX888NN8N#NXX88XX"                 ..-+-++;;:'.+:=:;""""//""+                  
    888NNNNN@N8NNX:             .' .+:=-:""""??";:;=;=;;"/?"/*/"==+'               
    88II*:-+.                  -'..'+=:+:;"";"//?"?";;""??""?/*?":=++       ""*8@@@
                    '.''   -.  .''.:;;::;/?""//??""*///////"?/?""???":+  I@@@@@@@@@
                    .-.   .   .--'''':;:::""""//////*//?/??"?//?:"":'+++  8@@@@@@@@
                 -?  -    .    '' .'+::=::;?;?/////I**/////"?////?":;""?"=*@@@@@@@@
        ?.""""?"   ..          .'' -::=-::::"//?//****///*/"?//?///:=?*/O*;I@@@@@@@
    8@@@8X88$"       .             .--+-+:??;?////****/*O*////*/*OO*""*SX*:*@@@@@@#
    @@@@N8##/     '            .'  .  .-+:=:?//??/***///I*/////*/OOXIO*ISI::"#@N@@8
    N@@@#NX/     '              .  ...'''+==:?*/////*II*////*I****SN8XX8XO";O@@@@NN
    NN@N8IO:                       ......'+:=://///*//////I*//**//X$N8XSI*:+"8@@@@8
    8X8SI?:.                        ''..-;;:::""///////////OI***/IXSIXXI**///8@@@@N
    SXII**"                     ''  . . .'-+:?//";/?/?///?//**I//?*XIOXSI/??"ON@@@8
    IS88I/+                        .'..'-+=:""""";??/?;;/*/"//?;/****OOO//??/O@@@@N
    SOIIS*:                         .'. '-=;""?";;????""/////*?""/*OO**O//""/X@@@@N
    SSXSIO"                          ...-:+=:??";;"?/*//**/"//"";?;/O****/""*8@@@@N
    IIXII*;                           .-:;:;"??/?/??/?"?""??//;;"?/*//*I*?""*N@@@@N
    S8X*?O;                          ...-:?";"/?;;???/"??"?"";;;;"*OO?**I/?/ONN#@@X
    *SSO**"                       '..  ';??:-+===+:"????/""??=="";/IO//OO*?/8@@#@@X
    SIIOO"     +:.        .'-'   .-  '=-+:+-+=";=="???/?";?;;""";?/O*/*OOO/O8NNN@@8
    SOOIO"    /*O?.        .=:   .:   -+:*O/"*XOOO**/;=;?";;==?/""/II"?*???"  ?@@@X
    XXSSII"   *$@#S*"-    .'+=   ?: .//"OX88@@@@@@@$I?==:"::=;;;;?*8XO*OIX8/:+;*@@@
    XOSIS8/   '. .;O$8I*=  .+-  -/?+:IX8@@@@@@@@@N$$NX*"";:=="?::?XNX*O*//**X@$8@@X
    IIXSSS"        -:=;"/";;:'  =I$N8N#@@@N8/:-:;/*I$N88X/:==;""?/O$8I*///?"?IS8@@N
    SSX8SOO'   ;@@@@@@@X:.      :X@@@@N$N8IO:::;""/////XXXI;+:";="XNN//??////*O*@@@
    IX88IX;   ;*:.;#@@II*=      ?XX$8XN@@@@@@@@@@@@@@I==///??"=="/O8X""//;:"I8XS@@@
    XXXIXO:      '=;//?";=     '?*I8XSIS@@@@@@$N$?=:INN8X*?"?"++="OII"?/OI/?//*I@@@
    IXI/O;       -+"";:='+.    :?/OSOIX*X888X/"?""/I/?"////*/?:;"?/I*""X@@*;:=?$@@N
    IXIXO?           '.'-.     "?/OIIOOOX8$XO//?;;;;/?""?/"?""::;""/I/"/$@@I/:;O@@@
    SXOO*;           :??.      :?/***/O?/IXXO*?:=;""??"???"//??";"";""??/8@$/;?@@@8
    OXSIO.         .:/=       '""*SI/*//??OIIIO:+;"";;=;"?"???";=+"""?//O$@I;/X@@@8
    SSSI/=         '          .:*I*I*/"///""*XXO?""";:;??/""?//:=;/?"/XXI*/?/I$@@@$
    ISII/'                    =:?/*////"?//?"///*/?"=:=;"//???";;:;";?*I/??*OX$$$@8
    OXSX/;                    .:?//**/?///;;/*///?//*?;;/*/"??;;;"?";*II/??*IN8S8@N
    OIII*?                    '=///?/*//OO/:"?/"?"///?//////:"?;=;";=?//";/X@NX8NN8
    ISX//?+           .+      /?;///?///O8X*-.;/////*??*//?"/?";;;";";;"?"X$$SSX$NS
    OIII*O?           ;:      "///"??"??I@@X/;-+:;//**/////?;"";+::=?/?-=X@$SSXI8$8
    IXX***?'        +O=      =///O*/////?/*X$X?===?/*//////??/?":;"/X@@XXSOSSSS8N8I
    OOO**/*"        ";   ."?*XX8$X8@@@I'.=:"$@8;++:"//??//?/??;==;=:"X$XSSIISSSIXNX
    OOIOI*/"       ..       .?IXO/?/";:=:?"==XN/;+::;;??//??"?""+;:"*8NXIOOIOSIIX8X
    *OIO?/*/                  ?O+.;*/"=;;"?;::/I/;;;;;:;??";?";+=::;/@$OIO*/OIOOXNI
    OOIO/??/                  ""  ;**"==;""";"?"";?";???;"??;?"==;??IN8XIO*OIIIS8NI
    /OOO/"?*'                 ;+  :O*;=;;"?;;:;;;=:/?;;?????"":":::?XXIIIO**II**XNO
    //O*/?**:        .            ?*?;=;////?":=::;?";:""//?"";"";"/I8S*****II**8$O
    *O*/?*//"-    +/88" .:=::''."I@$XXIIIIXXXI"+'+;;=="/?"""";":=""IX***I/?/O**OSX*
    /OOO/?//*"    .:'     +?/O88$88XIOIXI*//*XX?=':;";;//?;""""?"/*IX?*IOO*OII*I88O
    OIOO*/*OO*:               -'   '+"/*?**?"/*/;=""":"///??"////?8@@?"**//OIO*S88O
    *OIIOOI/*I/+         --'. .---:*SOI**//???///?";;;?**"/"?*//*8@@@X+./OOXIOOOXNI
    *OOI*/**O*/?.        ';+*8NX**/ISI/?//";;?/?"?/*?;?/?//"///**@@@@$"+:/OIOOOSN8O
    *IIO*IIO**?*?        '=-';:==;;"/IO////?"////?*/??//*////O*8@@@@@@NS":"*IOO8NNI
    /*I***ISO*"**:        ..   .-=://*/?*/?//?/?";;;"*///*//?*$@@@@@@@@@O++///OS88I
    /OXIO*OOII**I*+            '-="""??;;?/"/?//?"??/*/*/***I@@@@@@@@@@@@I::***XNNI
    OOII***O*/**O?/+           .'  -??:=;?"?"/////*IXI*/*X$@@@@@@@@@@@@@@O."OISX8NS
    OIISOOIISIOOOO*/;        -"=  .="//;?????/***IX8XS*OX@@@@@@@@@@@@@@@S++"/**OSN8
    O*OSIOOSO**IO***O"      -;??   "/I/"//////*OX$8XXS$@@@@@@@@@@@@@@@@@"=""//"""/?
    OIIOOOOIS*//O*/?$@*     -?"-  =*OIX/*II*OX$XX8@@@@@@@@@@@@@@@@@@@@@@""OISIOOOO?
    *OOO*??*OO8@@@@@@@@I'    -:=++:O#$XXX8XI8$8@@@@@@@@@@@@@@@@@@@@@@@@X/OXOSSOO/SX
    *OO*SSXN@@@@@@@@@@@@@NI"O*OXN@@@@@@$$#@$N@@@@@@@@@@@@@@@@@@@@@@@@@@@XO""/ININ@#
    SSXXXX##@NN#@#@@OO@@@@#XOII"  ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@O"::O8@@@@@@
    S888XX##N$S$$N$*/O@@@@@@XIN@/   "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@$=="N@@@@@@@@@
  • #14 / Feb 17, 2008 12:21am

    wiredesignz

    2882 posts

    Not quite pr0n 😛
    But still very clever.

  • #15 / Feb 28, 2008 9:23am

    xwero

    4145 posts

    config.php

    Leave blank to allow all characters -- but only if you are insane.
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases