fry-send_tweet.rb 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +282 -0
  3. data/LICENSE.txt +24 -0
  4. data/PRY_LICENSE.txt +25 -0
  5. data/README.md +456 -0
  6. data/Vagrantfile +46 -0
  7. data/art/44-e44743a5bb.jpg +0 -0
  8. data/art/52-eec4df2edf.jpg +0 -0
  9. data/lib/pry-send_tweet.rb +75 -0
  10. data/lib/pry/pager/system_pager.rb +25 -0
  11. data/lib/pry/send_tweet/commands/base_command.rb +70 -0
  12. data/lib/pry/send_tweet/commands/easter_eggs.rb +184 -0
  13. data/lib/pry/send_tweet/commands/paging/paging_support.rb +16 -0
  14. data/lib/pry/send_tweet/commands/read_tweets.rb +93 -0
  15. data/lib/pry/send_tweet/commands/read_tweets/translate_actions.rb +94 -0
  16. data/lib/pry/send_tweet/commands/send_tweet.rb +151 -0
  17. data/lib/pry/send_tweet/commands/twitter_action.rb +118 -0
  18. data/lib/pry/send_tweet/commands/twitter_action/delete_tweet_actions.rb +19 -0
  19. data/lib/pry/send_tweet/commands/twitter_action/follow_actions.rb +66 -0
  20. data/lib/pry/send_tweet/commands/twitter_action/like_actions.rb +23 -0
  21. data/lib/pry/send_tweet/commands/twitter_action/mute_actions.rb +23 -0
  22. data/lib/pry/send_tweet/commands/twitter_action/profile_actions.rb +60 -0
  23. data/lib/pry/send_tweet/commands/twitter_action/suggested_actions.rb +20 -0
  24. data/lib/pry/send_tweet/commands/twitter_search.rb +36 -0
  25. data/lib/pry/send_tweet/renderers/tweet_renderer.rb +103 -0
  26. data/lib/pry/send_tweet/renderers/user_renderer.rb +17 -0
  27. data/lib/pry/send_tweet/tty-box.rb +73 -0
  28. data/lib/pry/send_tweet/twitter_io.rb +26 -0
  29. data/lib/pry/send_tweet/version.rb +5 -0
  30. data/lib/time-ago-in-words/README.md +14 -0
  31. data/lib/time-ago-in-words/lib/time-ago-in-words.rb +37 -0
  32. data/lib/time-ago-in-words/time-ago-in-words.gemspec +14 -0
  33. data/pry-send_tweet.gemspec +23 -0
  34. data/samples/freebsd-zshrc +5 -0
  35. data/samples/tmuxinator-vagrant.yml +11 -0
  36. data/vms/freebsd.rb +15 -0
  37. metadata +123 -0
@@ -0,0 +1,46 @@
1
+ require 'shellwords'
2
+ insert_root_path = ->(tmux_conf) {
3
+ conf = YAML.load(tmux_conf)
4
+ conf['root'] = '/app'
5
+ YAML.dump(conf)
6
+ }
7
+
8
+ Vagrant.configure("2") do |config|
9
+ config.vm.box = "generic/freebsd12"
10
+ config.vm.synced_folder Dir.getwd, "/app", type: "rsync"
11
+
12
+ config.vm.provider "virtualbox" do |vb|
13
+ vb.memory = "1024"
14
+ end
15
+
16
+ # Install useful packages
17
+ cmds = [
18
+ "sudo pkg install -y zsh tmux",
19
+ "sudo chsh -s zsh vagrant"
20
+ ]
21
+ config.vm.provision "shell", inline: cmds.join(' && ')
22
+
23
+ # Configure date & time
24
+ zone = ENV.key?('VMTZ') ? ENV['VMTZ'] : 'CET'
25
+ cmds = [
26
+ "cp /usr/share/zoneinfo/#{zone} /etc/localtime"
27
+ ]
28
+ config.vm.provision "shell", inline: cmds.join(' && ')
29
+
30
+ # Insert files into VM
31
+ tmux_conf = insert_root_path.call File.binread('./samples/tmuxinator-vagrant.yml')
32
+ cmds = [
33
+ "echo '#{File.binread('./samples/freebsd-zshrc')}' > /home/vagrant/.zshrc",
34
+ "mkdir -p /home/vagrant/.config/tmuxinator",
35
+ "echo #{Shellwords.shellescape(tmux_conf)} > /home/vagrant/.config/tmuxinator/pry_send_tweet.yml"
36
+ ]
37
+ config.vm.provision "shell", inline: cmds.join(' && ')
38
+
39
+ # Install Ruby
40
+ # Install pry-send_tweet dependencies (..as FreeBSD packages)
41
+ cmds = [
42
+ "sudo pkg install -y ruby rubygem-tmuxinator rubygem-pry rubygem-twitter " \
43
+ "rubygem-tty-box rubygem-unicode-display_width"
44
+ ]
45
+ config.vm.provision "shell", inline: cmds.join(' && ')
46
+ end
Binary file
Binary file
@@ -0,0 +1,75 @@
1
+ class Pry
2
+ module SendTweet
3
+ #
4
+ # @return [Integer]
5
+ # The default width of a box that contains a tweet or user.
6
+ #
7
+ # @api private
8
+ #
9
+ DEFAULT_BOX_WIDTH = 100
10
+
11
+ #
12
+ # @return [Integer]
13
+ # The default height of a box that contains a tweet or user.
14
+ #
15
+ DEFAULT_BOX_HEIGHT = 8
16
+
17
+ #
18
+ # @return [Integer]
19
+ # The number of tweets to request when reading tweets from Twitters API.
20
+ #
21
+ # @api private
22
+ #
23
+ DEFAULT_READ_SIZE = 200
24
+
25
+ require 'pry' if not defined?(Pry::ClassCommand)
26
+ require 'twitter'
27
+ require 'cgi'
28
+ require 'timeout'
29
+ require 'yaml'
30
+ require 'time-ago-in-words'
31
+ require_relative 'pry/send_tweet/twitter_io'
32
+ require_relative 'pry/pager/system_pager'
33
+ require_relative 'pry/send_tweet/tty-box'
34
+ require_relative 'pry/send_tweet/renderers/tweet_renderer'
35
+ require_relative 'pry/send_tweet/renderers/user_renderer'
36
+ require_relative 'pry/send_tweet/commands/paging/paging_support'
37
+ require_relative 'pry/send_tweet/commands/base_command'
38
+ require_relative 'pry/send_tweet/commands/send_tweet'
39
+ require_relative 'pry/send_tweet/commands/read_tweets'
40
+ require_relative 'pry/send_tweet/commands/twitter_search'
41
+ require_relative 'pry/send_tweet/commands/twitter_action'
42
+ require_relative 'pry/send_tweet/commands/easter_eggs'
43
+ require_relative 'pry/send_tweet/version'
44
+
45
+ # @api private
46
+ def self.merge_yaml_file!(config, path)
47
+ if File.readable?(path)
48
+ warn "[warning] Reading pry-send_tweet configuration from '#{path}'."
49
+ twitter_config = YAML.safe_load File.binread(path)
50
+ config.twitter = Pry::Config.from_hash(twitter_config)
51
+ end
52
+ rescue => e
53
+ warn "[warning] Error parsing '#{path}' .. (#{e.class})."
54
+ end
55
+ end
56
+ end
57
+
58
+ Pry.configure do |config|
59
+ b = lambda do |*ary|
60
+ pry = ary[-1]
61
+ twitter = Twitter::REST::Client.new do |config|
62
+ Pry::SendTweet.merge_yaml_file! pry.config,
63
+ File.join(ENV['HOME'], '.pry-send_tweet.yml')
64
+ config.consumer_key = pry.config.twitter.consumer_key
65
+ config.consumer_secret = pry.config.twitter.consumer_secret
66
+ config.access_token = pry.config.twitter.access_token
67
+ config.access_token_secret = pry.config.twitter.access_token_secret
68
+ end
69
+ twitter.user_agent = pry.config.twitter.user_agent ||
70
+ "pry-send_tweet.rb v#{Pry::SendTweet::VERSION}"
71
+ pry.add_sticky_local(:_twitter_) { twitter }
72
+ end
73
+ config.hooks.add_hook(:before_eval, 'pry_send_tweets_before_eval', b)
74
+ config.hooks.add_hook(:before_session, 'pry_send_tweets_before_session', b)
75
+ end
@@ -0,0 +1,25 @@
1
+ class Pry::Pager::SystemPager
2
+ def pid
3
+ pager.pid
4
+ end
5
+
6
+ def fork
7
+ pager
8
+ nil
9
+ end
10
+
11
+ def fast_exit!
12
+ Process.kill 'SIGKILL', pid
13
+ Process.wait pid
14
+ end
15
+
16
+ private
17
+ # Patch to avoid spawning a shell when launching the pager.
18
+ def pager
19
+ @pager ||= begin
20
+ ary = self.class.default_pager.split(' ')
21
+ io = IO.popen(ary, 'w')
22
+ io.tap{|io| io.sync = true}
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,70 @@
1
+ class Pry::Slop
2
+ DEFAULT_OPTIONS.merge!(strict: true)
3
+ end
4
+
5
+ class Pry::SendTweet::BaseCommand < Pry::ClassCommand
6
+ include Pry::SendTweet::TweetRenderer
7
+ include Pry::SendTweet::UserRenderer
8
+ include Pry::SendTweet::PagingSupport
9
+
10
+ def self.inherited(kls)
11
+ kls.group 'Twitter'
12
+ end
13
+
14
+ def process(*args)
15
+ if nil == _pry_.config.twitter
16
+ raise Pry::CommandError, "_pry_.config.twitter is nil!\n" \
17
+ "Please set the required keys and tokens to send " \
18
+ "tweets using Twitters API. \n" \
19
+ "Visit https://gitlab/trebor8/fry-send_tweet.rb to learn how."
20
+ end
21
+ end
22
+
23
+ private
24
+
25
+ def default_read_size
26
+ _pry_.config.twitter.default_read_size || Pry::SendTweet::DEFAULT_READ_SIZE
27
+ end
28
+
29
+ def box_height
30
+ Pry::SendTweet::DEFAULT_BOX_HEIGHT
31
+ end
32
+
33
+ def box_width
34
+ _pry_.config.twitter.box_width || Pry::SendTweet::DEFAULT_BOX_WIDTH
35
+ end
36
+
37
+ def search_str_for_users(*ary)
38
+ ary.map do |str|
39
+ if str.start_with?('https://twitter.com')
40
+ path = URI.parse(URI.escape(str)).path
41
+ path.split('/').reject(&:empty?).first
42
+ elsif str.start_with?('@')
43
+ str[1..-1]
44
+ else
45
+ str
46
+ end
47
+ end
48
+ end
49
+
50
+ # With thanks to ActionView for this method
51
+ def word_wrap(text, options = {})
52
+ line_width = box_width
53
+ text.split("\n").collect! do |line|
54
+ line.length > line_width ? line.gsub(/(.{1,#{line_width}})(\s+|$)/, "\\1\n").strip : line
55
+ end * "\n"
56
+ end
57
+
58
+ def numbered_list(title, ary)
59
+ title = "\n#{bold(title.chomp)}\n\n"
60
+ title + ary.map.with_index { |item, index| yield(item, index+1) }.join("\n")
61
+ end
62
+
63
+ def time_format
64
+ "%-d %b %Y, %-I:%M:%S %p"
65
+ end
66
+
67
+ def twitter
68
+ @twitter ||= _pry_.binding_stack[-1].eval('_twitter_')
69
+ end
70
+ end
@@ -0,0 +1,184 @@
1
+ Pry.commands.instance_eval do
2
+ command(/[Bb]ismillah/, "") {
3
+ _pry_.pager.page [
4
+ "The ِBeneficient / All-Compassionate / Most Gracious",
5
+ "The Most Merciful / Ever-Merciful / Merciful / Most Clement",
6
+ 'The King / Lord / Sovereign / Dominion / Master [also means "the God/ Lord, the One and Only", "Possessor of Supreme Power or Authority"]',
7
+ "The Holy / All-Holy / All-Pure / Sacred / All-Sacred",
8
+ "The Giver of Peace / Peace / All-Calm / Ever-Tranquil",
9
+ "The Granter of Security / the Giver / Faith / Supreme Believer (of Belief) / Giver of Belief / All-Assurer",
10
+ "The Controller / Absolute Authority Over All / Guardian Over All / Absolute Master / Eternal Dominating",
11
+ "The Exalted in Might and Power / Exalted / Powerful / Almighty / Mighty",
12
+ "The Omnipotent / Supreme Power / Possessor of Having All Power / Strong",
13
+ "The Possessor of Greatness / Supreme / Justly Proud",
14
+ "The Creator / Creator of the Universe / Maker / True Originator / Absolute Author",
15
+ "The Initiator / Evolver/ Eternal Spirit Worshipped By All, Have Absolute Power Over All Matters, Nature and Events",
16
+ "The Fashioner / Shaper / Designer / Artist",
17
+ "The Repeatedly Forgiving / Absolute Forgiver / Pardoner / Condoner [He Who is Ready to Pardon and Forgive]",
18
+ "The Subduer / Overcomer / Conqueror / Absolute Vanquisher [Possessor of Who Subdues Evil and Oppression]",
19
+ "The ِِAbsolute Bestower / Giver / Grantor / Great Donor",
20
+ "The Provider / Sustainer / Bestower of Sustenance / All-Provider",
21
+ "The Opener / Opener of the Gates of Profits / Reliever / The Victory Giver",
22
+ "The Knowing / All-Knower / Omniscient / All-Knowledgeable / Possessor of Knowing Much of Ever Thing / All-Knowing",
23
+ "The Restrainer / Withholder / Straightener / Absolute Seizer",
24
+ "The Extender / Expander / Generous Provider",
25
+ "The Abaser / Humiliator / Downgrader [Possessor of Giving Comfort, Free from Pain Anxiety or Troubles]",
26
+ "The Exalter / Upgrader [of Ranks]",
27
+ "The Giver of Honor / Bestower of Honor / Empowerer",
28
+ "The Giver of Dishonor / the Giver of Disgrace",
29
+ "The Hearing / All-Hearing / Hearer of Invocation",
30
+ "The All-Seeing / All-Seer / Ever-Clairvoyant / Clear-Sighted / Clear-Seeing",
31
+ "The Judge / Arbitrator / Arbiter / All-Decree / Possessor of Authority of Decisions and Judgment",
32
+ "The Just / Authorized and Straightforward Judge of Dealing Justly",
33
+ "The Gentle / Benignant / Subtly Kind / All-Subtle",
34
+ "The All-Aware / Well-Acquainted / Ever-Adept",
35
+ "The Forbearing / Indulgent / Oft Forbearing / All-Enduring (of Suffering Pain with Patience)",
36
+ "The Most Great / Ever-Magnificent / Most Supreme / Exalted / Absolute Dignified",
37
+ "The Ever-Forgiving / Oft-Forgiving",
38
+ "The Grateful / Appreciative / Multiplier of Rewards",
39
+ "The Sublime / Ever-Exalted / Supreme / Most High / Most Lofty",
40
+ "The Great/ Ever-Great / Grand / Most Great / Greatly Abundant of Extent, Capacity and Importance",
41
+ "The Preserver / Ever-Preserving / All-Watching / Protector / Guardian / Oft-Conservator",
42
+ "The Nourisher / Feeder",
43
+ "The Bringer of Judgment / Ever-Reckoner [the One Who Takes Account of All Matters]",
44
+ "The Majestic / Exalted / Oft-Important / Splendid",
45
+ "The Noble / Bountiful / Generous / Precious / Honored / Benefactor",
46
+ "The Watchful / Observer / Ever-Watchful / Watcher",
47
+ "The Responsive / Answerer / Supreme Answerer / Accepter of Invocation",
48
+ "The Vast/ All-Embracing / Omnipresent / Boundless / All-Encompassing",
49
+ "The Wise/ Ever-Wise / Endowed with Sound Judgment",
50
+ "The Affectionate / Ever-Affectionate/ Loving One/ Loving/ the One Who Tenders and Warm Hearts",
51
+ "The All-Glorious / Majestic / Ever-Illustrious [Oft-Brilliant in Dignity, Achievements or Actions]",
52
+ "The Resurrector / Awakener / Arouser / Dispatcher",
53
+ "The Witness / Testifier / Ever-Witnessing",
54
+ "The Truth / Reality / the Only One Certainly Sound and Genuine in Truth",
55
+ "The Trustee, The Dependable, The Advocate",
56
+ "The Strong",
57
+ "The Firm, The Steadfast",
58
+ "The Friend, Helper",
59
+ "The All Praiseworthy",
60
+ "The Accounter, The Numberer of All",
61
+ "The Originator, The Producer, The Initiator",
62
+ "The Restorer, The Reinstater Who Brings Back All",
63
+ "The Giver of Life",
64
+ "The Bringer of Death",
65
+ "The Living",
66
+ "The Subsisting, The Independent",
67
+ "The Perceiver, The Finder, The Unfailing",
68
+ "The Illustrious, The Magnificent",
69
+ "The Unique, The Single",
70
+ "The One, The Indivisible",
71
+ "The Eternal, The Absolute, The Self-Sufficient",
72
+ "The All-Powerful, He Who is able to do Everything",
73
+ "The Determiner, The Dominant",
74
+ "The Expediter, He Who Brings Forward",
75
+ "The Delayer, He Who Puts Far Away",
76
+ "The First, The Beginning-less",
77
+ "The Last, The Endless",
78
+ "The Manifest, The Evident, The Outer",
79
+ "The Hidden, The Unmanifest, The Inner",
80
+ "The Patron, The Protecting Friend, The Friendly Lord",
81
+ "The Supremely Exalted, The Most High",
82
+ "The Good, The Beneficent",
83
+ "The Ever-Returning, Ever-Relenting",
84
+ "The Avenger",
85
+ "The Pardoner, The Effacer, The Forgiver",
86
+ "The Kind, The Pitying",
87
+ "The Owner of all Sovereignty",
88
+ "The Owner, Lord of Majesty and Honour",
89
+ "The Equitable, The Requiter",
90
+ "The Gatherer, The Unifier",
91
+ "The Rich, The Independent",
92
+ "The Enricher, The Emancipator",
93
+ "The Preventer, The Withholder, The Shielder, The Defender",
94
+ "The Distressor, The Harmer, The Afflictor",
95
+ "The Propitious, The Benefactor, The Source of Good",
96
+ "The Light",
97
+ "The Guide, The Way",
98
+ "The Originator, The Incomparable, The Unattainable, The Beautiful",
99
+ "The Immutable, The Infinite, The Everlasting",
100
+ "The Heir, The Inheritor of All",
101
+ "The Guide to the Right Path",
102
+ "The Timeless, The Patient"
103
+ ].sample
104
+ }
105
+ alias_command '99', 'bismillah'
106
+
107
+ DISCO_BISCUITS = {
108
+ 'Steve Miller Band - Abracadabra (12" Version) (Vinyl)' => 'https://www.youtube.com/watch?v=YqloCj1ZNSw',
109
+ 'Billy Joel Piano Man Lyrics' => 'https://www.youtube.com/watch?v=ErEzQOFzPXU',
110
+ '6IX9INE - STOOPID FT. BOBBY SHMURDA (Official Music Video)' => 'https://www.youtube.com/watch?v=VDa5iGiPgGs',
111
+ 'NOOP DOGG - O M G (3RIS D3D3 REMIX)' => 'https://www.youtube.com/watch?v=PJL8-DZEscs',
112
+ 'The Frames - Star Star **' => 'https://www.youtube.com/watch?v=eMccPJqyg0o',
113
+ '6ix9ine, Nicki Minaj, Murda Beatz - “FEFE” (Official Music Video)' => 'https://www.youtube.com/watch?v=V_MXGdSBbAI',
114
+ 'Breaking Bad - Jesse\'s emotional speech' => 'https://www.youtube.com/watch?v=aL9aI4JPtPQ',
115
+ 'The Frames - Revelate with lyrics' => 'https://www.youtube.com/watch?v=SPC0sRQbJ98',
116
+ 'The Way I Am' => 'https://www.youtube.com/watch?v=82lB-gI-uuQ',
117
+ 'Coldplay - Fix You' => 'https://www.youtube.com/watch?v=k4V3Mo61fJM',
118
+ 'O Ri Chiraiya lyrics' => 'https://www.youtube.com/watch?v=56bdi4AJFFo',
119
+ 'Will Smith - Fresh Prince of Bel Air (Le Boeuf Remix)' => 'https://www.youtube.com/watch?v=LPvCeNxsG-w',
120
+ 'Midnight Oil - Beds Are Burning' => 'https://www.youtube.com/watch?v=ejorQVy3m8E',
121
+ 'Lenny Kravitz - Are You Gonna Go My Way' => 'https://www.youtube.com/watch?v=8LhCd1W2V0Q',
122
+ 'Yes - Owner Of A Lonely Heart (vinyl)' => 'https://www.youtube.com/watch?v=5mYMFcnOURs',
123
+ 'Toto - Africa (vinyl)' => 'https://www.youtube.com/watch?v=-M0m5mB_q0Y',
124
+ 'Bill Withers - Just The Two Of Us (Doumëa Remix ft. Kevin Cohen)' => 'https://www.youtube.com/watch?v=5mYMFcnOURs',
125
+ 'Pink Floyd - Money (master tape)' => 'https://www.youtube.com/watch?v=gmV9iX-Q754',
126
+ 'Pink Floyd - Wish You Were Here' => 'https://www.youtube.com/watch?v=IXdNnw99-Ic',
127
+ 'CHIEF KEEF - 3HUNNA / shot by @DJKENN_AON' => 'https://www.youtube.com/watch?v=QFEhJfUcD1Q',
128
+ 'Lil Boosie: We Out Chea' => 'https://www.youtube.com/watch?v=tOYnJv3ztKM',
129
+ 'John Legend All Of Me Lyrics' => 'https://www.youtube.com/watch?v=Mk7-GRWq7wA',
130
+ 'Im a trumpsta motherfucker' => 'https://www.youtube.com/watch?v=WhGsq9X1VZM',
131
+ 'Big Man Tyrone Shills Terry Davis\' TempleOS' => 'https://www.youtube.com/watch?v=HFPM-R_d44M',
132
+ 'Sam Song..... Celtic Storm' => 'https://www.youtube.com/watch?v=TjJR-fvGOXc',
133
+ 'Johnny Cash Reads The New Testament: Matthew Chapter 7' => 'https://www.youtube.com/watch?v=27TfH3hvqAQ',
134
+ 'Tina Turner - Golden Eye (HD)' => 'https://www.youtube.com/watch?v=4hGQ97tCTOs',
135
+ 'Red Hot Chili Peppers - By The Way (Lukas Grinys Remix)' => 'https://www.youtube.com/watch?v=lESwb2mU04M',
136
+ 'Avril Lavigne - I Love You' => 'https://www.youtube.com/watch?v=Q0-omvd2u1s',
137
+ 'RIGGA x DXTR - Город не спит 🔥' => 'https://www.youtube.com/watch?v=d3zQTHbEpkM',
138
+ '2017 11 26T18 46 30+00 00 171126WorshipWorkPlay' => 'https://www.youtube.com/watch?v=i-Re-PbqNRg',
139
+ 'Black Eyed Peas - Where Is The Love (BCX ft. Ellena Soule Rework)' => 'https://www.youtube.com/watch?v=0_Ro2ifLRpw',
140
+ 'Charlie Puth - Attention (D33pSoul Remix)' => 'https://www.youtube.com/watch?v=IMj7bSSOEAk',
141
+ 'Bob Marley - Three little birds(Video Oficial)(HQ)' => 'https://www.youtube.com/watch?v=4k2PJFPu57Y',
142
+ 'War veteran: "Please don\'t talk about leaving"' => 'https://www.youtube.com/watch?v=1jGnaPrjeh4',
143
+ 'Sunshine by Matisyahu Lyrics' => 'https://www.youtube.com/watch?v=xmQ2QrNnZIE',
144
+ 'Martin Garrix - Animals (Official Video)' => 'https://www.youtube.com/watch?v=gCYcHz2k5x0',
145
+ 'DVBBS & Borgeous - TSUNAMI (Original Mix)' => 'https://www.youtube.com/watch?v=0EWbonj7f18',
146
+ 'We Were Soldiers Broken Arrow' => 'https://www.youtube.com/watch?v=ctnK7wdJmAo',
147
+ '✵ Жизнь дает свое ✵ (2018)' => 'https://www.youtube.com/watch?v=Z2ozs8-W4H4',
148
+ 'Vladimir Putin Style - True Leader 2017' => 'https://www.youtube.com/watch?v=_A4MmpJV94I',
149
+ 'Survivor - Eye Of The Tiger (Rocky OST)' => 'https://www.youtube.com/watch?v=FLZS3jQPn',
150
+ 'Ноггано, AK 47 - Russian Paradise' => 'https://www.youtube.com/watch?v=Z0s1RTZUAqQ',
151
+ 'Meiko - Lights On(Mellen Gi Remix)' => 'https://www.youtube.com/watch?v=HVzL0XjdFfI',
152
+ '2Pac - Real Talk (2019)' => 'https://www.youtube.com/watch?v=_3LuY9isL_Y',
153
+ 'Девочка верна только одному..♛' => 'https://www.youtube.com/watch?v=UGmRumCtCrc',
154
+ 'Linkin Park - Numb (Areon Remix) /Chester Bennington/' => 'https://www.youtube.com/watch?v=-g29i6IOzUQ',
155
+ 'Steve Miller Band - Abracadabra (12" Version) (Vinyl)' => 'https://www.youtube.com/watch?v=YqloCj1ZNSw',
156
+ 'Gorillaz - Clint Eastwood (Godlips Remix)' => 'https://www.youtube.com/watch?v=JfJLyuXgjOc',
157
+ 'Narwhals song swimming in the ocean !' => 'https://www.youtube.com/watch?v=dP2lyc53qtI',
158
+ 'Justin Bieber - Sorry (D33pSoul Remix) /Tayler Buono Cover/' => 'https://www.youtube.com/watch?v=r5IO6ReMWXE',
159
+ 'Tupac Ft Elton John Ghetto Gospel Lyrics' => 'https://www.youtube.com/watch?v=eC3F1uZJ2jc',
160
+ 'SWAY - STILL SPEEDIN\' (With Lyrics) OUT NOW!!!!' => 'https://www.youtube.com/watch?v=tRldCYkU8nA',
161
+ 'Chief Keef is 300 years old' => 'https://www.youtube.com/watch?v=VWUg1fgYPiE',
162
+ 'DJ Fresh ft Sian Evans - \'Louder\' (Official Video)' => 'https://www.youtube.com/watch?v=eE-dwpWpscU',
163
+ '50 Cent - Realest Niggaz (ft. 2Pac & The Notorious B.I.G) 2018' => 'https://www.youtube.com/watch?v=QI_7C3dUgqw',
164
+ 'Tupac - Last Muthafucka Breathin\'' => 'https://www.youtube.com/watch?v=F3kN5x51wjE',
165
+ 'Rihanna - Work ft. Drake (Koni Remix) /Emma & Shaun Cover/' => 'https://www.youtube.com/watch?v=ipjXYtoVG-Q',
166
+ 'Money Gang - 2Pac Ft. Notorious B.I.G (HD)' => 'https://www.youtube.com/watch?v=R96NrNdAzQE',
167
+ 'MKJ - Robot /Frank Sinatra/' => 'https://www.youtube.com/watch?v=bGT1SbFW9OQ',
168
+ 'D33pSoul - La Richesse (Original Mix) "My richness is life" /Bob Marley/' => 'https://www.youtube.com/watch?v=tCXqm8EQtWQ',
169
+ 'Damo & Ivor \'Maniac 2012\' (Official Video)' => 'https://www.youtube.com/watch?v=js-Yet5kskA'
170
+ }
171
+ command '🎧', '' do
172
+ key = DISCO_BISCUITS.keys.uniq.sample
173
+ _pry_.output.puts [key, DISCO_BISCUITS[key]].join("\n")
174
+ end
175
+ alias_command 'disco-biscuits', '🎧'
176
+
177
+ command '300', '' do
178
+ _pry_.output.puts 'https://www.youtube.com/watch?v=VWUg1fgYPiE'
179
+ end
180
+
181
+ command '8', '' do
182
+ _pry_.output.puts 'https://www.jesuschristsavior.net/Beatitudes.html'
183
+ end
184
+ end
@@ -0,0 +1,16 @@
1
+ module Pry::SendTweet::PagingSupport
2
+ def page(str)
3
+ _pry_.pager.page(str.to_s)
4
+ end
5
+
6
+ def page_ok(str)
7
+ prefix = bright_green "OK: "
8
+ page "#{prefix}#{str}"
9
+ end
10
+
11
+ def page_error(str)
12
+ str = str.respond_to?(:message) ? str.message : str
13
+ prefix = bright_red "Error: "
14
+ page "#{prefix}#{str}"
15
+ end
16
+ end
@@ -0,0 +1,93 @@
1
+ class Pry::SendTweet::ReadTweets < Pry::SendTweet::BaseCommand
2
+ require_relative 'read_tweets/translate_actions'
3
+ include TranslateActions
4
+
5
+ match 'read-tweets'
6
+ description 'Read tweets.'
7
+ banner <<-BANNER
8
+ read-tweets [OPTIONS]
9
+
10
+ #{description}
11
+ BANNER
12
+
13
+ def options(o)
14
+ o.on 't=', 'tweeter=',
15
+ 'A username whose timeline you want to read.'
16
+ o.on 'c=', 'count=',
17
+ "The number of tweets to read. The maximum is 200, and the default is " \
18
+ "#{default_read_size}."
19
+ o.on 'l=', 'likes=',
20
+ 'Read tweets you or another user have liked.',
21
+ argument: :optional
22
+ o.on 'r=', 'replies=', 'A username whose replies you want to read.'
23
+ o.on 'm', 'mentions', 'Read tweets that @mention you.'
24
+ o.on 'x=', 'translate=', 'Translate a tweet.'
25
+ o.on 'tx=', nil, 'Translate a string of text.'
26
+ o.on 'sl=', 'source-lang=', '[optional] The source language of the ' \
27
+ 'text or tweet being translated'
28
+ o.on 'w', 'with-retweets', 'Include retweets.'
29
+ end
30
+
31
+ def process
32
+ super
33
+ case
34
+ when opts.present?('translate') then translate_tweet(opts['x'], opts['sl'])
35
+ when opts.present?('tx') then translate_text(opts['tx'], opts['sl'])
36
+ when opts.present?('replies') then show_replies(user: opts['replies'])
37
+ when opts.present?('likes') then show_likes(user: opts['likes'])
38
+ when opts.present?('mentions') then show_mentions
39
+ else show_tweets_from_timeline(user: opts['tweeter'])
40
+ end
41
+ end
42
+
43
+ private
44
+
45
+ def show_replies(user:)
46
+ username = search_str_for_users(user).first
47
+ render_tweets lambda {
48
+ twitter.user_timeline(username, timeline_options).select {|tweet|
49
+ tweet.reply? &&
50
+ tweet.in_reply_to_screen_name? &&
51
+ tweet.in_reply_to_screen_name.downcase != username.downcase
52
+ }
53
+ },
54
+ title: "#{'@'+user} replies"
55
+ end
56
+
57
+ def show_likes(user:)
58
+ if user
59
+ user = search_str_for_users(user).first
60
+ render_tweets lambda { twitter.favorites(user, count: opts['count'] || default_read_size)},
61
+ title: "#{'@'+user} likes"
62
+ else
63
+ render_tweets lambda { twitter.favorites(count: opts['count'] || default_read_size) },
64
+ title: "Your likes"
65
+ end
66
+ end
67
+
68
+ def show_tweets_from_timeline(user:)
69
+ if user
70
+ user = search_str_for_users(user).first
71
+ render_tweets lambda { twitter.user_timeline(user, timeline_options) },
72
+ title: '@'+user
73
+ else
74
+ render_tweets lambda { twitter.home_timeline(timeline_options) },
75
+ title: "Twitter"
76
+ end
77
+ end
78
+
79
+ def show_mentions
80
+ render_tweets lambda { twitter.mentions(timeline_options) },
81
+ title: "@mentions"
82
+ end
83
+
84
+ def timeline_options
85
+ {
86
+ tweet_mode: 'extended',
87
+ include_rts: opts.present?('with-retweets'),
88
+ count: opts.present?('count') ? opts['count'] : default_read_size
89
+ }
90
+ end
91
+
92
+ Pry.commands.add_command self
93
+ end