chris_lib 1.1.1 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +7 -0
- data/lib/chris_lib/chris_math.rb +5 -6
- data/lib/chris_lib/shell_methods.rb +13 -1
- data/lib/chris_lib/version.rb +1 -1
- metadata +34 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26df390957f20f20441a3da82c65e6fa68731a8068125770243351728e1308ff
|
4
|
+
data.tar.gz: 5c13712b08730ed559809aeba40b7e804c9a7a60e1244512c88ee1ca5338fb84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ac1fa114466fbc2cdd5b3cd023e36150ad78914b90df118a94fc9005a097a68832757e18e6ad97f021c347d323b75cfaad2d4ae7dce2b124a42ce64399b23f9
|
7
|
+
data.tar.gz: c3f5f7bc4dbc27bbc5be8234b71801a4d52cdb7ee001c812ed69309ae1e749e3b7eaf0579e8e195f7f80af03917d87cd78b7293009e822d2e9afc824a0316b79
|
data/Rakefile
CHANGED
@@ -14,8 +14,15 @@ RDoc::Task.new(:rdoc) do |rdoc|
|
|
14
14
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
15
|
end
|
16
16
|
|
17
|
+
begin
|
18
|
+
require 'rspec/core/rake_task'
|
17
19
|
|
20
|
+
RSpec::Core::RakeTask.new(:spec)
|
18
21
|
|
22
|
+
task :default => :spec
|
23
|
+
rescue LoadError
|
24
|
+
puts 'no rspec available'
|
25
|
+
end
|
19
26
|
|
20
27
|
Bundler::GemHelper.install_tasks
|
21
28
|
|
data/lib/chris_lib/chris_math.rb
CHANGED
@@ -14,20 +14,19 @@ Array.class_eval do
|
|
14
14
|
# s=c(7.08195525827783, 10.831582068121444, 9.288611270369554, 9.054684238411918, 12.268532229606647)
|
15
15
|
# returns 9.705073
|
16
16
|
fail 'Length must be greater than 0.' if length < 1
|
17
|
-
sum = self.inject { |s, v| s + v }
|
18
17
|
sum.to_f / length
|
19
18
|
end
|
20
19
|
|
21
20
|
# unbiased sample variance of array
|
22
21
|
def var
|
23
|
-
fail 'Length must be greater than 1' if length < 2
|
24
|
-
mu =
|
25
|
-
|
26
|
-
total.to_f/(length - 1)
|
22
|
+
fail 'Length must be greater than 1' if length < 2
|
23
|
+
mu = mean
|
24
|
+
map { |v| (v**2 - mu**2) }.sum.to_f / (length - 1)
|
27
25
|
end
|
28
26
|
|
29
|
-
#
|
27
|
+
# sample standard deviation
|
30
28
|
def std
|
29
|
+
return 0 if var < 0.0 # perhaps due to rounding errors
|
31
30
|
Math.sqrt(var)
|
32
31
|
end
|
33
32
|
|
@@ -5,6 +5,18 @@ module ShellMethods
|
|
5
5
|
require 'optparse'
|
6
6
|
Dotenv.load
|
7
7
|
|
8
|
+
def file_size(file_path)
|
9
|
+
`stat -f%z #{file_path}`.to_i
|
10
|
+
end
|
11
|
+
|
12
|
+
def imessage_admin(msg)
|
13
|
+
`osascript -e 'tell application "Messages" to send "#{msg}" to buddy "admin"'`
|
14
|
+
end
|
15
|
+
|
16
|
+
def osx_notification(msg, title)
|
17
|
+
`osascript -e 'display notification "#{msg}" with title "#{title}"'`
|
18
|
+
end
|
19
|
+
|
8
20
|
def parse_options
|
9
21
|
@options = {}
|
10
22
|
OptionParser.new do |opts|
|
@@ -96,7 +108,7 @@ module ShellMethods
|
|
96
108
|
end
|
97
109
|
|
98
110
|
def check_chris_lib_status
|
99
|
-
gs=`cd ../chris_lib;git status`; lr=$?.
|
111
|
+
gs=`cd ../chris_lib;git status`; lr=$?.successful?
|
100
112
|
return unless gs['working tree clean'].nil? && gs['up-to-date'].nil?
|
101
113
|
puts "Exiting, chris_lib is not up to date with master."
|
102
114
|
exit 3
|
data/lib/chris_lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chris_lib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv
|
@@ -30,6 +30,20 @@ dependencies:
|
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 2.2.1
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: nokogiri
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 1.10.4
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 1.10.4
|
33
47
|
- !ruby/object:Gem::Dependency
|
34
48
|
name: rails
|
35
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,7 +53,7 @@ dependencies:
|
|
39
53
|
version: '5.1'
|
40
54
|
- - ">="
|
41
55
|
- !ruby/object:Gem::Version
|
42
|
-
version: 5.1.
|
56
|
+
version: 5.1.6.2
|
43
57
|
type: :development
|
44
58
|
prerelease: false
|
45
59
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -49,7 +63,7 @@ dependencies:
|
|
49
63
|
version: '5.1'
|
50
64
|
- - ">="
|
51
65
|
- !ruby/object:Gem::Version
|
52
|
-
version: 5.1.
|
66
|
+
version: 5.1.6.2
|
53
67
|
- !ruby/object:Gem::Dependency
|
54
68
|
name: sqlite3
|
55
69
|
requirement: !ruby/object:Gem::Requirement
|
@@ -90,6 +104,20 @@ dependencies:
|
|
90
104
|
- - ">="
|
91
105
|
- !ruby/object:Gem::Version
|
92
106
|
version: 3.7.2
|
107
|
+
- !ruby/object:Gem::Dependency
|
108
|
+
name: actionview
|
109
|
+
requirement: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: 5.1.6.2
|
114
|
+
type: :development
|
115
|
+
prerelease: false
|
116
|
+
version_requirements: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: 5.1.6.2
|
93
121
|
description: It includes maths, datetime, and rspec access test libraries.
|
94
122
|
email:
|
95
123
|
- obromios@gmail.com
|
@@ -127,7 +155,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
155
|
- !ruby/object:Gem::Version
|
128
156
|
version: '0'
|
129
157
|
requirements: []
|
130
|
-
|
158
|
+
rubyforge_project:
|
159
|
+
rubygems_version: 2.7.6.2
|
131
160
|
signing_key:
|
132
161
|
specification_version: 4
|
133
162
|
summary: This an eclectic collection of methods. It include maths, datetime, and rspec
|