21-day-challenge-countdown 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +32 -0
- data/bin/challenge_countdown +5 -0
- data/lib/21-day-challenge-countdown.rb +28 -0
- metadata +61 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d793e38fedfd1d06d503e6a45722741fa964f250
|
4
|
+
data.tar.gz: 5a2d883bfe716a65a3507e8941147842f7b71bee
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ff5bffa0616a57adf1a42ec6b4f7656dc642b46c578321317c3fd0db4892ecd2318ea28f055069c5a98a7fb6b21d7a142f0a684160a4c0deff129fd5143ffe6e
|
7
|
+
data.tar.gz: 17e12fbc249ed405279ae58da98f89db5c085dbe3f3ecf39dc99f2d784bfbad60d94b34de2a222f66c19808cfc40fba755ca1e29c07dc486c6b95125353889eb
|
data/README.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
#21-Day-Challenge Countdown timer
|
2
|
+
Are you worrying to deliver you pull request in time? Does the time-zone difference to "Mountain Time" give you trouble?
|
3
|
+
|
4
|
+
Worry no more:
|
5
|
+
No you can check easily how much time is left on the clock and what the current day in the challenge is.
|
6
|
+
|
7
|
+
Special thanks to [Victor Goff](https://github.com/kotp) for the inspiration.
|
8
|
+
|
9
|
+
##Intallation:
|
10
|
+
|
11
|
+
gem install 21-day-challenge-countdown
|
12
|
+
|
13
|
+
##Usage
|
14
|
+
|
15
|
+
The gem is quite simple to use:
|
16
|
+
|
17
|
+
###In your code:
|
18
|
+
```ruby
|
19
|
+
require "21-day-challenge-countdown"
|
20
|
+
countdown = TwentyOneDayChallenge::Countdown.new
|
21
|
+
countdown.current_day
|
22
|
+
# => 8
|
23
|
+
countdown.time_left
|
24
|
+
# => Thu, 01 Jan 1970 04:05:44 UTC +00:00
|
25
|
+
countdown.deadline
|
26
|
+
# => "Today is day 8. You have 04:05:44 left to send your pull request."
|
27
|
+
```
|
28
|
+
###Command line
|
29
|
+
```bash
|
30
|
+
$ challenge_countdown
|
31
|
+
Today is day 8. You have 04:03:04 left to send your pull request.
|
32
|
+
```
|
@@ -0,0 +1,28 @@
|
|
1
|
+
#Well I need a bit of rails (for convenience) here!
|
2
|
+
require 'active_support'
|
3
|
+
require 'active_support/time_with_zone'
|
4
|
+
require 'active_support/core_ext/time/zones'
|
5
|
+
|
6
|
+
module TwentyOneDayChallenge
|
7
|
+
class Countdown
|
8
|
+
attr_reader :time_left
|
9
|
+
attr_reader :current_day
|
10
|
+
|
11
|
+
def initialize()
|
12
|
+
Time.zone = "UTC"
|
13
|
+
start = ActiveSupport::TimeZone.new("Mountain Time (US & Canada)").parse("13/04/2015 12:00").to_datetime
|
14
|
+
now = Time.zone.now.to_datetime
|
15
|
+
elapsed = (now-start)
|
16
|
+
@current_day = (elapsed).ceil
|
17
|
+
next_deadline = start+@current_day
|
18
|
+
left_today = next_deadline.to_time-now.to_time
|
19
|
+
@time_left = Time.zone.at(left_today)
|
20
|
+
#left_string = @time_left.strftime("%H:%M:%S")
|
21
|
+
end
|
22
|
+
|
23
|
+
def deadline()
|
24
|
+
#enter your local time zone here!
|
25
|
+
return "Today is day #{self.current_day}. You have #{self.time_left.strftime("%H:%M:%S")} left to send your pull request."
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: 21-day-challenge-countdown
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Stefan Kahlert
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-04-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 4.2.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 4.2.1
|
27
|
+
description: Gives you a countdown to the next 21-day-challenge deadline
|
28
|
+
email: kahlert@gmail.com
|
29
|
+
executables:
|
30
|
+
- challenge_countdown
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- README.md
|
35
|
+
- bin/challenge_countdown
|
36
|
+
- lib/21-day-challenge-countdown.rb
|
37
|
+
homepage: https://github.com/RubySteps/21-day-challenge
|
38
|
+
licenses:
|
39
|
+
- MIT
|
40
|
+
metadata: {}
|
41
|
+
post_install_message:
|
42
|
+
rdoc_options: []
|
43
|
+
require_paths:
|
44
|
+
- lib
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
requirements: []
|
56
|
+
rubyforge_project:
|
57
|
+
rubygems_version: 2.4.3
|
58
|
+
signing_key:
|
59
|
+
specification_version: 4
|
60
|
+
summary: Deadline countdown
|
61
|
+
test_files: []
|