game-of-life-theme 0.1.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3a6609a1b568daa509ad78f461d82c0f8d52e34f
4
+ data.tar.gz: 89fe09a855665bd9ddb72f3b6716d8690ceac3fc
5
+ SHA512:
6
+ metadata.gz: 8eb88f831ad2c4baed2cabd58088aca916375ea4fddea17d2bf3a69d96af2acb15faeb22c5bdbc58d791b3568490ea116147f71c7f1871513c952ef2ccca4f57
7
+ data.tar.gz: 47ca8fc0b840d105a93cc1968ca559d8d870dcea550563e18630e86e1e9d3d1f6cf396b7779c88ac947dfa4d00c6161d5df1baf25089ed40c9ef3a44a7e10ae9
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Milana
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,62 @@
1
+ # game-of-life
2
+
3
+ Welcome to your new Jekyll theme! In this directory, you'll find the files you
4
+ need to be able to package up your theme into a gem. Put your layouts in
5
+ `_layouts`, your includes in `_includes` and your sass in `_sass`.
6
+
7
+ To experiment with this code, add some sample content and run `bundle exec jekyll
8
+ serve` – this directory is setup just like a Jekyll site!
9
+ Also, you can adjust this command
10
+ `bundle exec jekyll --host <host-name> --port <port>` to suit your needs.
11
+ Site will be available at `<host-name>:<port>` in your browser.
12
+
13
+ ## Installation
14
+
15
+ Add this line to your Jekyll site's `Gemfile`:
16
+
17
+ ```ruby gem "game-of-life" ```
18
+
19
+ And add this line to your Jekyll site's `_config.yml`:
20
+
21
+ ```yaml theme: game-of-life ```
22
+
23
+ And then execute:
24
+
25
+ $ bundle
26
+
27
+ Or install it yourself as:
28
+
29
+ $ gem install game-of-life
30
+
31
+ ## Contributing
32
+
33
+ Bug reports and pull requests are welcome on GitHub at
34
+ https://github.com/[USERNAME]/hello. This project is intended to be a safe,
35
+ welcoming space for collaboration, and contributors are expected to adhere to
36
+ the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
37
+
38
+ ## Development
39
+
40
+ To set up your environment to develop this theme, run `bundle install`.
41
+
42
+ Your theme is setup just like a normal Jekyll site! To test your theme, run
43
+ `bundle exec jekyll serve` and open your browser at `http://localhost:4000`.
44
+ This starts a Jekyll server using your theme. Add pages, documents, data, etc.
45
+ like normal to test your theme's contents. As you make modifications to your
46
+ theme and to your content, your site will regenerate and you should see the
47
+ changes in the browser after a refresh, just like normal.
48
+
49
+ When your theme is released, only the files in `_layouts`, `_includes`, and
50
+ `_sass` tracked with Git will be released.
51
+
52
+ ## License
53
+
54
+ The theme is available as open source under the terms of the [MIT
55
+ License](https://opensource.org/licenses/MIT).
56
+
57
+ ## Steps
58
+
59
+ - Ruby Gems account
60
+ - suppose that Ruby, Bundler and Jekyll are in place
61
+ - `jekyll new-theme <theme-name>`
62
+ - update `.gemspec` file
@@ -0,0 +1,6 @@
1
+ <head>
2
+ <meta charset="utf-8">
3
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
4
+ <meta name="viewport" content="width=device-width, initial-scale=1">
5
+ <link rel="stylesheet" href="{{ "/assets/main.css" | relative_url }}">
6
+ </head>
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html lang="{{ page.lang | default: site.lang | default: "en" }}">
3
+ {% include head.html %}
4
+ <body>
5
+ <div class="header flex">
6
+ <div class="wrapper">
7
+ <div class="content">
8
+ {{ content }}
9
+ </div>
10
+ </div>
11
+ </div>
12
+ </body>
13
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.6.0/p5.js"></script>
14
+ <script src="{{ site.url }}/assets/game_of_life.js"></script>
15
+ </html>
@@ -0,0 +1,32 @@
1
+ ---
2
+ layout: default
3
+ ---
4
+
5
+ <div class="card grey-background">
6
+ {% if page.title %}
7
+ <h1 class="page-heading">{{ page.title }}</h1>
8
+ {% endif %}
9
+
10
+ {{ content }}
11
+
12
+ {% if site.posts.size > 0 %}
13
+ <h2 class="post-list-heading">{{ page.list_title | default: "Posts" }}</h2>
14
+ <ul class="post-list">
15
+ {% for post in site.posts %}
16
+ <li>
17
+ {% assign date_format = site.minima.date_format | default: "%b %-d, %Y" %}
18
+ <span class="post-meta">{{ post.date | date: date_format }}</span>
19
+ <h3>
20
+ <a class="post-link" href="{{ post.url | relative_url }}">
21
+ {{ post.title | escape }}
22
+ </a>
23
+ </h3>
24
+ {% if site.show_excerpts %}
25
+ {{ post.excerpt }}
26
+ {% endif %}
27
+ </li>
28
+ {% endfor %}
29
+ </ul>
30
+ {% endif %}
31
+
32
+ </div>
@@ -0,0 +1,5 @@
1
+ ---
2
+ layout: default
3
+ ---
4
+
5
+ {{ content }}
@@ -0,0 +1,11 @@
1
+ ---
2
+ layout: default
3
+ ---
4
+
5
+ <div class="card grey-background">
6
+ <div class="post-title {% if page.feature %} feature {% endif %}">
7
+ <h1>{{ page.title }}</h1>
8
+ <h4>{{ page.date | date_to_string }}</h4>
9
+ </div>
10
+ {{ content }}
11
+ </div>
@@ -0,0 +1,98 @@
1
+ var w;
2
+ var columns;
3
+ var rows;
4
+ var board;
5
+ var next;
6
+
7
+ function setup() {
8
+ createCanvas(windowWidth, windowHeight);
9
+ w = 7;
10
+ columns = floor(width/w);
11
+ rows = floor(height/w);
12
+
13
+ board = create_board();
14
+ next = create_board();
15
+ randomize_color();
16
+ init();
17
+ }
18
+
19
+ function create_board(){
20
+ var boardVar;
21
+ boardVar = new Array(columns);
22
+ for (var i = 0; i < columns; i++) {
23
+ boardVar[i] = new Array(rows);
24
+ }
25
+ return(boardVar);
26
+ }
27
+
28
+ function randomize_color(){
29
+ r = random(255);
30
+ g = random(255);
31
+ b = random(255);
32
+ }
33
+
34
+ function draw() {
35
+ background(253, 253, 253);
36
+ generate();
37
+ for ( var i = 0; i < columns;i++) {
38
+ for ( var j = 0; j < rows;j++) {
39
+ if ((board[i][j] == 1)) fill(r, g, b);
40
+ else fill(253, 253, 255);
41
+ stroke(253, 253, 255);
42
+ rect(i*w, j*w, w-1, w-1);
43
+ }
44
+ }
45
+
46
+ }
47
+
48
+ function windowResized() {
49
+ resizeCanvas(windowWidth, windowHeight);
50
+ }
51
+
52
+ function mousePressed() {
53
+ randomize_color();
54
+ }
55
+
56
+ function keyPressed(){
57
+ randomize_color();
58
+ init();
59
+ }
60
+
61
+ function mouseDragged(){
62
+ i = floor(mouseX/w);
63
+ j = floor(mouseY/w);
64
+ next[i][j] = 1;
65
+ }
66
+
67
+ function init() {
68
+ for (var i = 0; i < columns; i++) {
69
+ for (var j = 0; j < rows; j++) {
70
+ if (i == 0 || j == 0 || i == columns-1 || j == rows-1) board[i][j] = 0;
71
+ else board[i][j] = floor(random(2));
72
+ next[i][j] = 0;
73
+ }
74
+ }
75
+ }
76
+
77
+ function generate() {
78
+ for (var x = 1; x < columns - 1; x++) {
79
+ for (var y = 1; y < rows - 1; y++) {
80
+ var neighbors = 0;
81
+ for (var i = -1; i <= 1; i++) {
82
+ for (var j = -1; j <= 1; j++) {
83
+ neighbors += board[x+i][y+j];
84
+ }
85
+ }
86
+
87
+ neighbors -= board[x][y];
88
+ if ((board[x][y] == 1) && (neighbors < 2)) next[x][y] = 0; // Loneliness
89
+ else if ((board[x][y] == 1) && (neighbors > 3)) next[x][y] = 0; // Overpopulation
90
+ else if ((board[x][y] == 0) && (neighbors == 3)) next[x][y] = 1; // Reproduction
91
+ else next[x][y] = board[x][y]; // Stasis
92
+ }
93
+ }
94
+
95
+ var temp = board;
96
+ board = next;
97
+ next = temp;
98
+ }
@@ -0,0 +1,162 @@
1
+ %extend1 {
2
+ margin: 0;
3
+ padding: 0;
4
+ width: 100%;
5
+ height: 100%;
6
+ font-size: 100%;
7
+ }
8
+
9
+ html {
10
+ @extend %extend1;
11
+ }
12
+
13
+ body {
14
+ background-position: center center;
15
+ background-attachment: fixed;
16
+ background-image: none !important;
17
+ background: $white;
18
+ }
19
+
20
+ .grey-background {
21
+ background-color: #fff5e6;
22
+ }
23
+
24
+ .card {
25
+ font-family: Fira Sans,sans-serif;
26
+ font-size: 15px;
27
+ margin: 10px;
28
+ padding: 2em;
29
+ border-radius: 2px;
30
+ }
31
+
32
+ .card:hover {
33
+ position: relative;
34
+ top: -5px;
35
+ left: -5px;
36
+ box-shadow: 5px 5px 5px #969696;
37
+ }
38
+
39
+ .content {
40
+ -moz-osx-font-smoothing: grayscale;
41
+ -webkit-font-smoothing: antialiased !important;
42
+ -moz-font-smoothing: antialiased !important;
43
+ text-rendering: optimizelegibility !important;
44
+ text-align: justify;
45
+ @media #{$small} {
46
+ padding: 0 .5em;
47
+ }
48
+ }
49
+
50
+ .header {
51
+ height: 100%;
52
+ position: relative;
53
+ margin: 200px 300px 100px 300px;
54
+ min-height: 300px;
55
+ min-width: 100px;
56
+ text-align: left;
57
+ color: $white;
58
+ @media #{$small} {
59
+ display: block !important;
60
+ }
61
+ @media only screen and (max-height: 500px) {
62
+ display: block !important;
63
+ }
64
+ }
65
+
66
+ canvas {
67
+ position: fixed;
68
+ top: 0;
69
+ z-index: -1;
70
+ width: 100%;
71
+ height: 100vh;
72
+ margin-left: 0em;
73
+ }
74
+
75
+ .highlight {
76
+ background: #F8FAFC;
77
+ @extend %vertical-rhythm;
78
+
79
+ .c { color: #998; font-style: italic } // Comment
80
+ .err { color: #a61717; background-color: #e3d2d2 } // Error
81
+ .k { font-weight: bold } // Keyword
82
+ .o { font-weight: bold } // Operator
83
+ .cm { color: #998; font-style: italic } // Comment.Multiline
84
+ .cp { color: #999; font-weight: bold } // Comment.Preproc
85
+ .c1 { color: #998; font-style: italic } // Comment.Single
86
+ .cs { color: #999; font-weight: bold; font-style: italic } // Comment.Special
87
+ .gd { color: #000; background-color: #fdd } // Generic.Deleted
88
+ .gd .x { color: #000; background-color: #faa } // Generic.Deleted.Specific
89
+ .ge { font-style: italic } // Generic.Emph
90
+ .gr { color: #a00 } // Generic.Error
91
+ .gh { color: #999 } // Generic.Heading
92
+ .gi { color: #000; background-color: #dfd } // Generic.Inserted
93
+ .gi .x { color: #000; background-color: #afa } // Generic.Inserted.Specific
94
+ .go { color: #888 } // Generic.Output
95
+ .gp { color: #555 } // Generic.Prompt
96
+ .gs { font-weight: bold } // Generic.Strong
97
+ .gu { color: #aaa } // Generic.Subheading
98
+ .gt { color: #a00 } // Generic.Traceback
99
+ .kc { font-weight: bold } // Keyword.Constant
100
+ .kd { font-weight: bold } // Keyword.Declaration
101
+ .kp { font-weight: bold } // Keyword.Pseudo
102
+ .kr { font-weight: bold } // Keyword.Reserved
103
+ .kt { color: #458; font-weight: bold } // Keyword.Type
104
+ .m { color: #099 } // Literal.Number
105
+ .s { color: #d14 } // Literal.String
106
+ .na { color: #008080 } // Name.Attribute
107
+ .nb { color: #0086B3 } // Name.Builtin
108
+ .nc { color: #458; font-weight: bold } // Name.Class
109
+ .no { color: #008080 } // Name.Constant
110
+ .ni { color: #800080 } // Name.Entity
111
+ .ne { color: #900; font-weight: bold } // Name.Exception
112
+ .nf { color: #900; font-weight: bold } // Name.Function
113
+ .nn { color: #555 } // Name.Namespace
114
+ .nt { color: #000080 } // Name.Tag
115
+ .nv { color: #008080 } // Name.Variable
116
+ .ow { font-weight: bold } // Operator.Word
117
+ .w { color: #bbb } // Text.Whitespace
118
+ .mf { color: #099 } // Literal.Number.Float
119
+ .mh { color: #099 } // Literal.Number.Hex
120
+ .mi { color: #099 } // Literal.Number.Integer
121
+ .mo { color: #099 } // Literal.Number.Oct
122
+ .sb { color: #d14 } // Literal.String.Backtick
123
+ .sc { color: #d14 } // Literal.String.Char
124
+ .sd { color: #d14 } // Literal.String.Doc
125
+ .s2 { color: #d14 } // Literal.String.Double
126
+ .se { color: #d14 } // Literal.String.Escape
127
+ .sh { color: #d14 } // Literal.String.Heredoc
128
+ .si { color: #d14 } // Literal.String.Interpol
129
+ .sx { color: #d14 } // Literal.String.Other
130
+ .sr { color: #009926 } // Literal.String.Regex
131
+ .s1 { color: #d14 } // Literal.String.Single
132
+ .ss { color: #990073 } // Literal.String.Symbol
133
+ .bp { color: #999 } // Name.Builtin.Pseudo
134
+ .vc { color: #008080 } // Name.Variable.Class
135
+ .vg { color: #008080 } // Name.Variable.Global
136
+ .vi { color: #008080 } // Name.Variable.Instance
137
+ .il { color: #099 } // Literal.Number.Integer.Long
138
+ }
139
+
140
+ pre,
141
+ code {
142
+ @include relative-font-size(0.9375);
143
+ border: 1px solid $grey-color-light;
144
+ border-radius: 3px;
145
+ background-color: #F8FAFC;
146
+
147
+ }
148
+
149
+ code {
150
+ padding: 1px 5px;
151
+ }
152
+
153
+ pre {
154
+ padding: 8px 12px;
155
+ overflow-x: auto;
156
+
157
+ > code {
158
+ border: 0;
159
+ padding-right: 0;
160
+ padding-left: 0;
161
+ }
162
+ }
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: game-of-life-theme
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Milana
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-03-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: jekyll
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.4'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.4'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.12'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.12'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ description:
56
+ email:
57
+ - milana.stojadinov@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - LICENSE.txt
63
+ - README.md
64
+ - _includes/head.html
65
+ - _layouts/default.html
66
+ - _layouts/home.html
67
+ - _layouts/page.html
68
+ - _layouts/post.html
69
+ - assets/game_of_life.js
70
+ - assets/main.css
71
+ homepage: https://github.com/mimimalizam/game-of-life
72
+ licenses:
73
+ - MIT
74
+ metadata: {}
75
+ post_install_message:
76
+ rdoc_options: []
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ requirements: []
90
+ rubyforge_project:
91
+ rubygems_version: 2.5.1
92
+ signing_key:
93
+ specification_version: 4
94
+ summary: Jekyll and p5.js theme on famous Game of life
95
+ test_files: []