string song

i made a shortcut for song writing! is here: apieceofstring (needs ruby. ruby is here: http://www.ruby-lang.org)

if you ask it nicely it make song about string. like: GreatSong.new.sing

if you ask it extra nicely it sing about other things too. like: GreatSong.new(‘cheese’).sing

cheese is good

4 Responses to “string song”

  1. I don’t know Ruby. I have downloaded the file but cannot use it. This makes me sad. Can it sing about sad things?

  2. blodgett says:

    it can! maybe some or all of these steps will be necessary:

    acquire the shiny for your operating system from here:
    http://www.ruby-lang.org/en/downloads/

    open the interactive shiny! type irb in a terminal for linux and osx or open start > applications > ruby > fxri or something like that if you have the window one (like it says here: http://www.ruby-lang.org/en/documentation/quickstart/)

    you might need to change to the directory where you glommed the string song to: type Dir.chdir ‘path/to/stringsong’ then press enter, where ‘path/to/stringsong’ is where it got put. single or double quotes both ok. the ruby interactive shiny should tell you ‘0’.

    type require ‘apieceofstring’. this gloms the file into the interactive shiny. then you can play with it! :D

    if you want song of sad, you can type GreatSong.new(‘sad’).sing
    and it will sing for you sad song.

    i did this and it looks a bit like this:

    blodgett@home:~$ irb
    irb(main):001:0> Dir.chdir ‘dl’
    => 0
    irb(main):002:0> require ‘apieceofstring’
    => true
    irb(main):003:0> GreatSong.new(‘fun!’).sing
    a piece of fun!
    a piece of fun!
    a piece of fun!
    a piece of fun!
    a piece of fun!
    a piece of fun!
    a piece of
    fun!
    fun!
    fun!
    fun!
    fun!
    => 5
    irb(main):004:0>

  3. Cakesniffer says:

    Can do like this too:

    nick@pickle:~$ ruby -r ‘/tmp/apieceofstring.rb’ -e “GreatSong.new(‘cheese’).sing”
    a piece of cheese
    a piece of cheese
    a piece of cheese
    a piece of cheese
    a piece of cheese
    a piece of cheese
    a piece of
    cheese
    cheese
    cheese
    cheese
    cheese

  4. blodgett says:

    this is true. but maybe harder to understand. also limits play time to thing in quotes.