basics 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/basics +9 -8
- metadata +73 -85
data/bin/basics
CHANGED
@@ -12,15 +12,11 @@ markdown = Redcarpet::Markdown.new(ConsoleRenderer)
|
|
12
12
|
|
13
13
|
def get(url)
|
14
14
|
begin
|
15
|
-
JSON.parse(open(url).read)
|
15
|
+
JSON.parse(open(url).read.encode("UTF-8", :invalid => :replace, :undef => :replace, :replace => ""))
|
16
16
|
rescue OpenURI::HTTPError => e
|
17
17
|
puts (e.to_s + " with url: #{url}").color(:red)
|
18
18
|
puts "file a bug report at https://github.com/egonschiele/basics".color(:yellow)
|
19
19
|
exit
|
20
|
-
rescue
|
21
|
-
puts "ERROR! with url: #{url}".color(:red)
|
22
|
-
puts "file a bug report at https://github.com/egonschiele/basics".color(:yellow)
|
23
|
-
exit
|
24
20
|
end
|
25
21
|
end
|
26
22
|
|
@@ -34,14 +30,14 @@ when 0
|
|
34
30
|
usage
|
35
31
|
when 1
|
36
32
|
if ARGV[0] == "-l"
|
37
|
-
|
33
|
+
p get(URL + "categories").map { |x| x['name'] }.sort
|
38
34
|
exit
|
39
35
|
elsif ARGV[0] == "-h" || ARGV[0] == "--help"
|
40
36
|
usage
|
41
37
|
end
|
42
38
|
tips = get(URL + "search/#{URI.escape(ARGV[0])}")
|
43
39
|
when 2
|
44
|
-
tips = get(URL + "
|
40
|
+
tips = get(URL + "search/#{URI.escape(ARGV[0])}/#{ARGV[1]}")
|
45
41
|
end
|
46
42
|
|
47
43
|
if tips.size == 0
|
@@ -54,21 +50,26 @@ puts "CONTENTS:".color(:yellow)
|
|
54
50
|
prev_category = nil
|
55
51
|
|
56
52
|
tips.each do |tip|
|
53
|
+
=begin DISABLING CATEGORIES FOR NOW
|
57
54
|
if tip["category"] != prev_category
|
58
55
|
prev_category = tip["category"]
|
59
56
|
puts tip["category"].upcase.background(:red).foreground("#000000")
|
60
57
|
end
|
58
|
+
=end
|
61
59
|
puts tip["title"].background(:white).foreground("#000000")
|
62
60
|
end
|
63
61
|
|
64
62
|
prev_category = nil
|
65
63
|
puts "\nDETAILS:".color(:yellow)
|
66
64
|
tips.each do |tip|
|
65
|
+
=begin DISABLING CATEGORIES FOR NOW
|
67
66
|
if tip["category"] != prev_category
|
68
67
|
prev_category = tip["category"]
|
69
68
|
puts tip["category"].upcase.background(:red).foreground("#000000")
|
70
69
|
end
|
71
|
-
|
70
|
+
=end
|
71
|
+
#puts "##{tip["id"].to_s} ".background(:red) + tip["title"].background(:white).foreground("#000000")
|
72
|
+
puts tip["title"].background(:white).foreground("#000000")
|
72
73
|
puts markdown.render(tip["text"])
|
73
74
|
puts "\n\n\n"
|
74
75
|
end
|
metadata
CHANGED
@@ -1,122 +1,110 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: basics
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 3
|
10
|
-
version: 0.0.3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.4
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Aditya Bhargava
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-02-01 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
22
15
|
name: json
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
25
17
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
33
22
|
type: :runtime
|
34
|
-
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: rainbow
|
37
23
|
prerelease: false
|
38
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
25
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rainbow
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
47
38
|
type: :runtime
|
48
|
-
version_requirements: *id002
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: redcarpet
|
51
39
|
prerelease: false
|
52
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
41
|
none: false
|
54
|
-
requirements:
|
55
|
-
- -
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: redcarpet
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
61
54
|
type: :runtime
|
62
|
-
version_requirements: *id003
|
63
|
-
- !ruby/object:Gem::Dependency
|
64
|
-
name: console_renderer
|
65
55
|
prerelease: false
|
66
|
-
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: console_renderer
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
67
65
|
none: false
|
68
|
-
requirements:
|
69
|
-
- -
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
|
72
|
-
segments:
|
73
|
-
- 0
|
74
|
-
version: "0"
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
75
70
|
type: :runtime
|
76
|
-
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
77
78
|
description: Cheat sheets for basic programming knowledge.
|
78
79
|
email: batman@scribd.com
|
79
|
-
executables:
|
80
|
+
executables:
|
80
81
|
- basics
|
81
82
|
extensions: []
|
82
|
-
|
83
83
|
extra_rdoc_files: []
|
84
|
-
|
85
|
-
files:
|
84
|
+
files:
|
86
85
|
- bin/basics
|
87
|
-
has_rdoc: true
|
88
86
|
homepage: https://github.com/egonSchiele/basics
|
89
87
|
licenses: []
|
90
|
-
|
91
88
|
post_install_message:
|
92
89
|
rdoc_options: []
|
93
|
-
|
94
|
-
require_paths:
|
90
|
+
require_paths:
|
95
91
|
- lib
|
96
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
97
93
|
none: false
|
98
|
-
requirements:
|
99
|
-
- -
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
|
102
|
-
|
103
|
-
- 0
|
104
|
-
version: "0"
|
105
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ! '>='
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
99
|
none: false
|
107
|
-
requirements:
|
108
|
-
- -
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
|
111
|
-
segments:
|
112
|
-
- 0
|
113
|
-
version: "0"
|
100
|
+
requirements:
|
101
|
+
- - ! '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
114
104
|
requirements: []
|
115
|
-
|
116
105
|
rubyforge_project:
|
117
|
-
rubygems_version: 1.
|
106
|
+
rubygems_version: 1.8.24
|
118
107
|
signing_key:
|
119
108
|
specification_version: 3
|
120
109
|
summary: Cheat sheets for basic programming knowledge.
|
121
110
|
test_files: []
|
122
|
-
|