Ask a Question related to Ruby, Design and Development.

  1. #1

    Default Ruby T-Shirt Idea

    Keywords: advocacy, silly t-shirts, Request For Feedback

    Hello from Yet Another Newbie Ruby User,
    I am not religious about languages, but have been really enjoying Ruby
    and need a new T-shirt for around the office. So I thought I would
    make one.

    Picture this in bold red print on a white shirt

    class RubyFan < OOProgrammer
    include OpenSource
    def initialize( name, talent )
    super( name, talent )
    # adjust for inherent Rubyness
    @productivity = CodeFu.MASTER * talent
    @stress_level = @stress_level / 2
    @street_cred = true;
    end
    end
    # [url]http://ruby-lang.org[/url]

    any thoughts? Anything inherantly un-rubyish?

    -- Ozten
    Austin King Guest

  2. Similar Questions and Discussions

    1. looking of an example with code how to take a boody for example and to "wrap" it with a shirt for example
      looking of an example with code how to take a boody for example and to "wrap" it with a shirt for example does any 1 know where i can see an...
    2. [ba-rb] BA-rb ( Bay Area Ruby Users Group ) - 'Generating Code in Ruby' by Jack Herrington.
      Count me in again, too. -- Jos Backus _/ _/_/_/ Sunnyvale, CA _/ _/ _/ _/ _/_/_/ _/ _/ _/ _/ jos at...
    3. T-shirt transfers
      How do I get my image to print correctly on transfer pager?
    4. [ANN] ruby-freedb, ruby-serialport, ruby-mp3info moved to Rubyforge
      http://ruby-freedb.rubyforge.org/ http://ruby-serialport.rubyforge.org/ http://ruby-mp3info.rubyforge.org/ bye! --...
    5. From Picture to T-Shirt??
      I guess you could use the channels pallette, turing off what you dont require.
  3. #2

    Default Re: Ruby T-Shirt Idea

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    I like the idea of Ruby t-shirts, but your code snipet is rather long for
    a t-shirt. It has to be quick and catchy. How about this:

    a, b = b, a
    Who needs temp variables?
    [url]http://www.ruby-lang.org[/url]


    Cheers,
    Daniel.


    On Thu, Jul 10, 2003 at 07:35:51AM +0900, Austin King wrote:
    > Keywords: advocacy, silly t-shirts, Request For Feedback
    >
    > Hello from Yet Another Newbie Ruby User,
    > I am not religious about languages, but have been really enjoying Ruby
    > and need a new T-shirt for around the office. So I thought I would
    > make one.
    >
    > Picture this in bold red print on a white shirt
    >
    > class RubyFan < OOProgrammer
    > include OpenSource
    > def initialize( name, talent )
    > super( name, talent )
    > # adjust for inherent Rubyness
    > @productivity = CodeFu.MASTER * talent
    > @stress_level = @stress_level / 2
    > @street_cred = true;
    > end
    > end
    > # [url]http://ruby-lang.org[/url]
    >
    > any thoughts? Anything inherantly un-rubyish?
    >
    > -- Ozten
    - --
    Daniel Carrera | OpenPGP fingerprint:
    Graduate TA, Math Dept | 6643 8C8B 3522 66CB D16C D779 2FDD 7DAC 9AF7 7A88
    UMD (301) 405-5137 | [url]http://www.math.umd.edu/~dcarrera/pgp.html[/url]
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.2 (SunOS)

    iD8DBQE/DJnFnxE8DWHf+OcRAiIuAKDpuQetF8lL6IStZZeGYnd9h+HRiA CeKLBf
    XS2ZvpI9HukuzUQpuI61QiA=
    =kl8Z
    -----END PGP SIGNATURE-----

    Daniel Carrera Guest

  4. #3

    Default Re: Ruby T-Shirt Idea

    il Thu, 10 Jul 2003 07:40:13 +0900, Daniel Carrera
    <dcarrera@math.umd.edu> ha scritto::
    >-----BEGIN PGP SIGNED MESSAGE-----
    >Hash: SHA1
    >
    >I like the idea of Ruby t-shirts, but your code snipet is rather long for
    >a t-shirt. It has to be quick and catchy. How about this:
    >
    > a, b = b, a
    > Who needs temp variables?
    > [url]http://www.ruby-lang.org[/url]
    >
    5.times { puts 'ruby r0x!'}
    gabriele renzi Guest

  5. #4

    Default Re: Ruby T-Shirt Idea

    On Thursday 10 July 2003 01:16, gabriele renzi wrote:
    > il Thu, 10 Jul 2003 07:40:13 +0900, Daniel Carrera
    >
    > <dcarrera@math.umd.edu> ha scritto::
    > >-----BEGIN PGP SIGNED MESSAGE-----
    > >Hash: SHA1
    > >
    > >I like the idea of Ruby t-shirts, but your code snipet is rather
    > > long for a t-shirt. It has to be quick and catchy. How about
    > > this:
    > >
    > > a, b = b, a
    > > Who needs temp variables?
    > > [url]http://www.ruby-lang.org[/url]
    >
    > 5.times { puts 'ruby r0x!'}
    "Please, keep your language clean" (seen on freenode#ruby-lang :-)

    -- fxn


    Xavier Noria Guest

  6. #5

    Default Re: Ruby T-Shirt Idea

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    On Thu, Jul 10, 2003 at 12:38:10PM +0900, Hal E. Fulton wrote:
    > Hmm, there's the classic "grep in four lines." Can't recall
    > exactly how it looks -- I think it used a perlism that I'm
    > not used to.
    Doesn't sound that hard. Could someone remind me how to use the File.eachline method? (I
    know I've gotten it at least partially wrong there).

    Or could someone give me a link to PickAxe so I can look it up?

    Thanks.
    - --
    Daniel Carrera | OpenPGP fingerprint:
    Graduate TA, Math Dept | 6643 8C8B 3522 66CB D16C D779 2FDD 7DAC 9AF7 7A88
    UMD (301) 405-5137 | [url]http://www.math.umd.edu/~dcarrera/pgp.html[/url]
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.2 (SunOS)

    iD8DBQE/DPaYnxE8DWHf+OcRAgBpAJ4rOuOAIb0ORCFAeF28LxvzrhPKQA Cg1r7a
    wyO1+BBDEHlaa/U0BNFSNLE=
    =bb9L
    -----END PGP SIGNATURE-----

    Daniel Carrera Guest

  7. #6

    Default Re: Ruby T-Shirt Idea

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Okay, ignore my last question (except the one about a link to PicAxe). I just figured the
    syntax (basically by trying every possible permutation).

    Now I have a new question: Turning a string into a regex.
    Example:

    dcarrera ~ $ irb
    >> var = "he"
    => "he"
    >> str = "hello world"
    => "hello world"
    >> str =~ /var/
    => nil

    What am I doing wrong?


    On Thu, Jul 10, 2003 at 02:16:15PM +0900, Daniel Carrera wrote:
    > On Thu, Jul 10, 2003 at 12:38:10PM +0900, Hal E. Fulton wrote:
    >
    > > Hmm, there's the classic "grep in four lines." Can't recall
    > > exactly how it looks -- I think it used a perlism that I'm
    > > not used to.
    >
    > Doesn't sound that hard. Could someone remind me how to use the File.eachline method? (I
    > know I've gotten it at least partially wrong there).
    >
    > Or could someone give me a link to PickAxe so I can look it up?
    >
    > Thanks.
    > --
    > Daniel Carrera | OpenPGP fingerprint:
    > Graduate TA, Math Dept | 6643 8C8B 3522 66CB D16C D779 2FDD 7DAC 9AF7 7A88
    > UMD (301) 405-5137 | [url]http://www.math.umd.edu/~dcarrera/pgp.html[/url]
    - --
    Daniel Carrera | OpenPGP fingerprint:
    Graduate TA, Math Dept | 6643 8C8B 3522 66CB D16C D779 2FDD 7DAC 9AF7 7A88
    UMD (301) 405-5137 | [url]http://www.math.umd.edu/~dcarrera/pgp.html[/url]
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.2 (SunOS)

    iD8DBQE/DPe+nxE8DWHf+OcRAiVLAKC3MnthkYBHoYr8qcDkL02x5hwYVg Cg1hBl
    j1H8eTK++lRHo+r1/nnqOcg=
    =HqaD
    -----END PGP SIGNATURE-----

    Daniel Carrera Guest

  8. #7

    Default Re: Ruby T-Shirt Idea

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    On Thu, Jul 10, 2003 at 12:38:10PM +0900, Hal E. Fulton wrote:
    > Hmm, there's the classic "grep in four lines." Can't recall
    > exactly how it looks -- I think it used a perlism that I'm
    > not used to.
    I just thought of a dead give-away:

    dcarrera ~ $ cat myfile
    cat
    dog
    horse
    zebra
    tiger
    dcarrera ~ $ grep a myfile
    cat
    zebra
    dcarrera ~ $ ruby -e 'puts ARGF.grep(/a/)' myfile
    cat
    zebra

    Cheers,
    - --
    Daniel Carrera | OpenPGP fingerprint:
    Graduate TA, Math Dept | 6643 8C8B 3522 66CB D16C D779 2FDD 7DAC 9AF7 7A88
    UMD (301) 405-5137 | [url]http://www.math.umd.edu/~dcarrera/pgp.html[/url]
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.2 (SunOS)

    iD8DBQE/DPkjnxE8DWHf+OcRAj6pAKCpfn6xzOYc7LaZbpXnIqeuivPtGw CdH8EP
    sMXOlzhmhrBrKJkt+Pa0lQE=
    =7kSC
    -----END PGP SIGNATURE-----

    Daniel Carrera Guest

  9. #8

    Default Re: Ruby T-Shirt Idea

    ----- Original Message -----
    From: "Daniel Carrera" <dcarrera@math.umd.edu>
    To: "ruby-talk ML" <ruby-talk@ruby-lang.org>
    Sent: Thursday, July 10, 2003 12:27 AM
    Subject: Re: Ruby T-Shirt Idea

    > I just thought of a dead give-away:
    >
    > dcarrera ~ $ cat myfile
    > cat
    > dog
    > horse
    > zebra
    > tiger
    > dcarrera ~ $ grep a myfile
    > cat
    > zebra
    > dcarrera ~ $ ruby -e 'puts ARGF.grep(/a/)' myfile
    > cat
    > zebra
    Quite right.

    The part I can't remember was one of those
    "implicit loop" things that I never use...

    BTW, var = Regexp.new(Regexp.escape(var)) will
    also do that conversion... probably more than
    two ways... ;)

    As for interpolating a variable into a regex,
    I'm not sure whether it does automatic escaping
    or not. I'd like to think it does, but there
    may be some good reason it doesn't. Too lazy to
    test right now...

    Hal

    --
    Hal Fulton
    [email]hal9000@hypermetrics.com[/email]



    Hal E. Fulton Guest

  10. #9

    Default Re: Ruby T-Shirt Idea

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    On Thu, Jul 10, 2003 at 02:27:45PM +0900, Hal E. Fulton wrote:
    > > What am I doing wrong?
    >
    > You can do str =~ /#{var}/ I think...
    Whoohoo!!!!

    dcarrera ~ $ alias mygrep="ruby -e 're=ARGV.shift; puts ARGF.grep(/#{re}/)'"
    dcarrera ~ $ mygrep a myfile
    cat
    zebra


    Whheeee!!!

    - --
    Daniel Carrera | OpenPGP fingerprint:
    Graduate TA, Math Dept | 6643 8C8B 3522 66CB D16C D779 2FDD 7DAC 9AF7 7A88
    UMD (301) 405-5137 | [url]http://www.math.umd.edu/~dcarrera/pgp.html[/url]
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.2 (SunOS)

    iD8DBQE/DPoXnxE8DWHf+OcRAn0+AJ43lESskNFnl3NpLflB2mLt3nAHAA CgmN0n
    r7Sv3FEGpNBCTgnoJxq8iBU=
    =JSEr
    -----END PGP SIGNATURE-----

    Daniel Carrera Guest

  11. #10

    Default Re: Ruby T-Shirt Idea

    On Thu, Jul 10, 2003 at 12:38:10PM +0900, Hal E. Fulton wrote:
    > > What can we use that demonstrates something that Ruby's uniquely
    > > useful for in 4 lines or less?
    >
    > Hmm, there's the classic "grep in four lines." Can't recall
    > exactly how it looks -- I think it used a perlism that I'm
    > not used to.
    What about

    require 'English'
    re = ARGV.shift
    $DEFAULT_INPUT.each{|x| puts x if x =~ /#{re}/}

    ??

    It's two lines if you use '$<'...

    --
    _ _
    | |__ __ _| |_ ___ _ __ ___ __ _ _ __
    | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \
    | |_) | (_| | |_\__ \ | | | | | (_| | | | |
    |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_|
    Running Debian GNU/Linux Sid (unstable)
    batsman dot geo at yahoo dot com

    Linux: because a PC is a terrible thing to waste
    -- [email]ksh@cis.ufl.edu[/email] put this on Tshirts in '93

    Mauricio Fernández Guest

  12. #11

    Default Re: Ruby T-Shirt Idea

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    On Thu, Jul 10, 2003 at 02:47:16PM +0900, Mauricio Fernández wrote:
    > What about
    >
    > require 'English'
    > re = ARGV.shift
    > $DEFAULT_INPUT.each{|x| puts x if x =~ /#{re}/}
    >
    > ??
    >
    > It's two lines if you use '$<'...
    Did you see mine? It was one line! (with a semicolon though :)


    - --
    Daniel Carrera | OpenPGP fingerprint:
    Graduate TA, Math Dept | 6643 8C8B 3522 66CB D16C D779 2FDD 7DAC 9AF7 7A88
    UMD (301) 405-5137 | [url]http://www.math.umd.edu/~dcarrera/pgp.html[/url]
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.2 (SunOS)

    iD8DBQE/DP6XnxE8DWHf+OcRAmPEAKD0z4FbF+GrAFhSoZRRYfQ417j8pA Cfb4Ww
    4ZOucZDZcqd+7ueFh2vbpoo=
    =hwOn
    -----END PGP SIGNATURE-----

    Daniel Carrera Guest

  13. #12

    Default Re: Ruby T-Shirt Idea

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    On Thu, Jul 10, 2003 at 03:18:01PM +0900, Mauricio Fernández wrote:
    > > Did you see mine? It was one line! (with a semicolon though :)
    >
    > They're the same if you omit the fact that I forgot about Enumerable#grep ;)
    > It turns out that $<, $DEFAULT_INPUT _and_ ARGF are synonyms.
    I didn't know that. I should have guessed.
    > IMHO one semicolon is equivalent to one line-break but we can still make
    > it a one-liner without cheating:
    >
    > re = ARGV.shift and puts ARGF.grep(/#{re}/)
    >
    > However, I don't quite like this example, it feels perlish.
    > I'd rather show singleton methods at work, or blocks, or metaclasses...
    Okay, so we agree on:

    re = ARGV.shift;
    ARGF.each{|x| puts x if x =~ /#{re}/}

    It's Rubyish, and it avoids the perlishms like "$<" (akward variable names) and the "and".
    A slight modification would be:

    re = ARGV.shift;
    puts ARGF.map{|x| x if x =~ /#{re}/}.compact


    I'm not sure which one I like better.

    - --
    Daniel Carrera | OpenPGP fingerprint:
    Graduate TA, Math Dept | 6643 8C8B 3522 66CB D16C D779 2FDD 7DAC 9AF7 7A88
    UMD (301) 405-5137 | [url]http://www.math.umd.edu/~dcarrera/pgp.html[/url]
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.2 (SunOS)

    iD8DBQE/DQb/nxE8DWHf+OcRArbCAKCO/B1vLUvv4Ld8zkoDxaNO3AN5rQCggZXc
    /PJ7o97NU+GHXaIqYm0DeKY=
    =aeFu
    -----END PGP SIGNATURE-----

    Daniel Carrera Guest

  14. #13

    Default Re: Ruby T-Shirt Idea

    On Thu, Jul 10, 2003 at 07:35:51AM +0900, Austin King wrote:
    > class RubyFan < OOProgrammer
    > include OpenSource
    > def initialize( name, talent )
    > super( name, talent )
    > # adjust for inherent Rubyness
    > @productivity = CodeFu.MASTER * talent
    > @stress_level = @stress_level / 2
    > @street_cred = true;
    > end
    > end
    Note that the semicolon isn't needed.

    Regards,

    Brian.

    Brian Candler Guest

  15. #14

    Default Re: Ruby T-Shirt Idea

    On Thu, Jul 10, 2003 at 02:16:15PM +0900, Daniel Carrera wrote:
    > Or could someone give me a link to PickAxe so I can look it up?
    [url]http://www.rubycentral.com/book/[/url]

    Or if you meant a specific reference for each_line, see
    [url]http://www.rubycentral.com/book/ref_c_io.html#IO.each_line[/url]

    Brian Candler Guest

  16. #15

    Default Re: Ruby T-Shirt Idea

    On Thu, Jul 10, 2003 at 02:27:07PM +0900, Daniel Carrera wrote:
    > I just thought of a dead give-away:
    >
    > dcarrera ~ $ cat myfile
    > cat
    > dog
    > horse
    > zebra
    > tiger
    > dcarrera ~ $ grep a myfile
    > cat
    > zebra
    > dcarrera ~ $ ruby -e 'puts ARGF.grep(/a/)' myfile
    > cat
    > zebra
    Or you can use nasty perlisms:

    $ ruby -ne 'print if /a/' myfile
    cat
    zebra

    Personally I think $_ should be abolished :-)

    Something that shows either the OO-nature of Ruby, or blocks/iterators in
    action, has got to be a good thing.

    Regards,

    Brian.

    Brian Candler Guest

  17. #16

    Default Re: Ruby T-Shirt Idea

    Hi,

    At Thu, 10 Jul 2003 15:26:14 +0900,
    Daniel Carrera wrote:
    > Okay, so we agree on:
    >
    > re = ARGV.shift;
    > ARGF.each{|x| puts x if x =~ /#{re}/}
    >
    > It's Rubyish, and it avoids the perlishms like "$<" (akward variable names) and the "and".
    > A slight modification would be:
    >
    > re = ARGV.shift;
    > puts ARGF.map{|x| x if x =~ /#{re}/}.compact
    They waits until all input end.

    ARGF.grep(Regexp.new(ARGV.shift)) {|l| puts l}

    or

    ARGF.grep(Regexp.new(ARGV.shift), &method(:puts))

    --
    Nobu Nakada

    nobu.nokada@softhome.net Guest

  18. #17

    Default Re: Ruby T-Shirt Idea

    Saluton!

    * gabriele renzi; 2003-07-10, 12:56 UTC:
    > 5.times { puts 'ruby r0x!'}
    puts ruby.rocks
    true

    Gis,

    Josef 'Jupp' Schugt
    --
    N'attribuez jamais à la malice ce que l'incompétence explique !
    -- Napoléon

    Josef 'Jupp' Schugt Guest

  19. #18

    Default Re: Ruby T-Shirt Idea

    What we need is a code snippet that is excessively long and obfuscate in
    Perl, such as a single line of code which has to wrap around the t-shirt to
    be completed (with all the @ and $ symbols, etc.), and then do the same in
    Ruby underneath... which only takes a fraction of the width of the front
    side of the shirt.

    __________________________________________________ _______________
    MSN 8 with e-mail virus protection service: 2 months FREE*
    [url]http://join.msn.com/?page=features/virus[/url]


    Orion Hunter Guest

  20. #19

    Default Re: Ruby T-Shirt Idea

    On Thu, Jul 10, 2003 at 03:26:14PM +0900, Daniel Carrera wrote:
    > Okay, so we agree on:
    >
    > re = ARGV.shift;
    > ARGF.each{|x| puts x if x =~ /#{re}/}
    Incidentally, you could make it more efficient by building the regex only
    once:

    re = /#{ARGV.shift}/
    ARGF.each{|x| puts x if x =~ re}

    Regards,

    Brian.

    Brian Candler Guest

  21. #20

    Default Re: Ruby T-Shirt Idea

    On Thursday 10 July 2003 22:32, Orion Hunter wrote:
    > What we need is a code snippet that is excessively long and obfuscate
    > in Perl, such as a single line of code which has to wrap around the
    > t-shirt to be completed (with all the @ and $ symbols, etc.), and
    > then do the same in Ruby underneath... which only takes a fraction of
    > the width of the front side of the shirt.
    IMHO it will be almost impossible to do that, being fair and idiomatic
    with the Perl version, writing readable Perl, and getting that ratio at
    the same time.

    Though I would be glad if I was proved wrong :-).

    -- fxn


    Xavier Noria Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139