rambling_hipster 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/rambling_hipster.rb +27 -0
- metadata +61 -0
| @@ -0,0 +1,27 @@ | |
| 1 | 
            +
            #!/usr/bin/env ruby
         | 
| 2 | 
            +
            require 'httparty'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            class HipsterJesus
         | 
| 5 | 
            +
              include HTTParty
         | 
| 6 | 
            +
              format :json
         | 
| 7 | 
            +
            end
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            class RamblingHipster
         | 
| 10 | 
            +
              def self.speak
         | 
| 11 | 
            +
                response = HipsterJesus.get('http://hipsterjesus.com/api/?paras=20&type=hipster-centric')
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                words = response['text'].split(' ')
         | 
| 14 | 
            +
                sentence = words.sample(5).collect {|x| x.gsub(/<\/?[^>]*>/,"").gsub(/\W/, "").downcase }.join(' ')
         | 
| 15 | 
            +
                final = words.keep_if { |w| /(?=.*^[a-z])(?=.*s$)/ =~ w }.sample
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                potlucks = ["Thundercats","squid","whatever","tattooed","letterpress","skateboard","Williamsburg","Portland","freegan","lo-fi","Brooklyn","hoodie","leggings","mustache","food truck","raw denim","jean shorts","tofu","trust fund","beard","wolf moon","DIY","fixie","farm-to-table","seitan","put a bird on it","VHS","mixtape","photo booth","artisan","scenester"]
         | 
| 18 | 
            +
             | 
| 19 | 
            +
             | 
| 20 | 
            +
                if (rand(8) == 4)
         | 
| 21 | 
            +
                  status = "Wanna have a #{potlucks.sample} potluck?" 
         | 
| 22 | 
            +
                else
         | 
| 23 | 
            +
                  status = "You probably haven't heard of #{sentence} #{final}."
         | 
| 24 | 
            +
                end
         | 
| 25 | 
            +
                puts status
         | 
| 26 | 
            +
              end
         | 
| 27 | 
            +
            end
         | 
    
        metadata
    ADDED
    
    | @@ -0,0 +1,61 @@ | |
| 1 | 
            +
            --- !ruby/object:Gem::Specification
         | 
| 2 | 
            +
            name: rambling_hipster
         | 
| 3 | 
            +
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            +
              version: 0.0.1
         | 
| 5 | 
            +
              prerelease: 
         | 
| 6 | 
            +
            platform: ruby
         | 
| 7 | 
            +
            authors:
         | 
| 8 | 
            +
            - Anthony Goddard
         | 
| 9 | 
            +
            autorequire: 
         | 
| 10 | 
            +
            bindir: bin
         | 
| 11 | 
            +
            cert_chain: []
         | 
| 12 | 
            +
            date: 2013-07-29 00:00:00.000000000 Z
         | 
| 13 | 
            +
            dependencies:
         | 
| 14 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 15 | 
            +
              name: httparty
         | 
| 16 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 17 | 
            +
                none: false
         | 
| 18 | 
            +
                requirements:
         | 
| 19 | 
            +
                - - ! '>='
         | 
| 20 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 21 | 
            +
                    version: '0'
         | 
| 22 | 
            +
              type: :runtime
         | 
| 23 | 
            +
              prerelease: false
         | 
| 24 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 25 | 
            +
                none: false
         | 
| 26 | 
            +
                requirements:
         | 
| 27 | 
            +
                - - ! '>='
         | 
| 28 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 29 | 
            +
                    version: '0'
         | 
| 30 | 
            +
            description: Generates a rambling hipster sentence, short enough for a tweet
         | 
| 31 | 
            +
            email: anthony@anthonygoddard.com
         | 
| 32 | 
            +
            executables: []
         | 
| 33 | 
            +
            extensions: []
         | 
| 34 | 
            +
            extra_rdoc_files: []
         | 
| 35 | 
            +
            files:
         | 
| 36 | 
            +
            - lib/rambling_hipster.rb
         | 
| 37 | 
            +
            homepage: https://github.com/agoddard/ramblinghipster
         | 
| 38 | 
            +
            licenses: []
         | 
| 39 | 
            +
            post_install_message: 
         | 
| 40 | 
            +
            rdoc_options: []
         | 
| 41 | 
            +
            require_paths:
         | 
| 42 | 
            +
            - lib
         | 
| 43 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 44 | 
            +
              none: false
         | 
| 45 | 
            +
              requirements:
         | 
| 46 | 
            +
              - - ! '>='
         | 
| 47 | 
            +
                - !ruby/object:Gem::Version
         | 
| 48 | 
            +
                  version: '0'
         | 
| 49 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 50 | 
            +
              none: false
         | 
| 51 | 
            +
              requirements:
         | 
| 52 | 
            +
              - - ! '>='
         | 
| 53 | 
            +
                - !ruby/object:Gem::Version
         | 
| 54 | 
            +
                  version: '0'
         | 
| 55 | 
            +
            requirements: []
         | 
| 56 | 
            +
            rubyforge_project: 
         | 
| 57 | 
            +
            rubygems_version: 1.8.23
         | 
| 58 | 
            +
            signing_key: 
         | 
| 59 | 
            +
            specification_version: 3
         | 
| 60 | 
            +
            summary: A rambling hipster
         | 
| 61 | 
            +
            test_files: []
         |