Skip to content
This repository was archived by the owner on Dec 15, 2020. It is now read-only.

Commit 9751d5f

Browse files
Merge pull request #7 from thepracticaldev/master
Merged changes up to 2017-04-17
2 parents 0b53bc9 + 87d6edf commit 9751d5f

15 files changed

+1079
-993
lines changed

.jshintignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
vendor/

.travis.yml

+17-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1-
language: node_js
2-
node_js:
3-
- "6"
4-
before_script:
5-
- npm install -g htmlhint csslint jshint
6-
script:
7-
- htmlhint
8-
- csslint stylesheets
9-
- jshint scripts
1+
dist: trusty
2+
sudo: false
3+
language: ruby
4+
python:
5+
- "3.6"
6+
install: ci/install.sh
7+
script: ci/all.sh
8+
gemfile: ci/Gemfile
9+
addons:
10+
apt:
11+
packages:
12+
# install Java 8 as required by vnu.jar
13+
- oracle-java8-installer
14+
- oracle-java8-set-default
15+
cache:
16+
bundler: true
17+
pip: true

README.md

+16-18
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,17 @@ View the result at [thepracticaldev.github.io/1pr](https://thepracticaldev.githu
1919
- Create a pull request
2020
- Hope you get picked
2121

22-
## Coding standards
23-
2422
## Project structure
23+
2524
The project's structure is pretty simple.
2625

2726
- HTML files go in the root directory
2827
- CSS goes in the `stylesheets/` directory
2928
- Javascript goes in the `scripts/` directory
3029
- Third-party libraries (CSS and JS) go in the `vendor/` directory, which is ignored by the linters (see **Testing** below).
3130

32-
3331
## Coding standards
32+
3433
When contributing, please try to follow the coding standards so we have nice looking code that's easy to follow for everyone.
3534

3635
### Editorconfig
@@ -59,27 +58,22 @@ Tab width is not defined in the editorconfig, so each deveveloper can set their
5958
- Use `lowerCamelCase` for variable names (not `snake_case`)
6059

6160
## Testing
61+
6262
The project contains the files `.htmlhintrc`, `.csslintrc` and `.jshintrc` with configuration for the respective testing utilities.
6363

6464
To install the testing utilities locally, simply install [Node.js](https://nodejs.org/en/) and then use npm (bundled with Node.js) to install the utilities:
6565

6666
```Bash
67-
# HTML validation
68-
npm install --global htmlhint
67+
npm install --global htmlhint csslint jshint
6968

70-
# CSS linter
71-
npm install --global csslint
72-
73-
# JSHint
74-
npm install --global jshint
75-
```
76-
77-
78-
#### HTML validation
69+
### HTML validation
7970

8071
Run the HTML validator with:
72+
8173
```
74+
8275
htmlhint
76+
8377
```
8478
8579
- All tags should be lowercase
@@ -92,12 +86,14 @@ htmlhint
9286
- No scripts in the head (place them at the bottom of the body)
9387
- No inline style attributes or javascript event handlers (e.g. `onclick=""`)
9488
95-
96-
#### CSS validation
89+
### CSS validation
9790
9891
Run the CSS validator with:
92+
9993
```
94+
10095
csslint stylesheets
96+
10197
```
10298
10399
- No empty rules
@@ -110,12 +106,14 @@ csslint stylesheets
110106
- Don't use regex selectors
111107
- Encourage the use of shorthand notation
112108
113-
114-
#### JS validation
109+
### JS validation
115110
116111
Run the Javascript validator with:
112+
117113
```
114+
118115
jshint scripts
116+
119117
```
120118
121119
- Always use strict mode

ci/all.sh

+3
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ set -ex
33
cd "$(git rev-parse --show-toplevel)"
44
mdl -g -r '~MD013' .
55
html5validator --root .
6+
htmlhint .
7+
jshint --config=.jshintrc .
8+
csslint --exclude-list=vendor .

ci/install.sh

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/bin/sh
2+
set -ex
23
cd "$(git rev-parse --show-toplevel)" || exit 1
34
bundle install --retry 3 --gemfile="$BUNDLE_GEMFILE"
45
pip install -r ci/requirements.txt
6+
npm install -g jshint htmlhint csslint

game.html

+26-9
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,44 @@
55

66
<title>Game - One PR A Day</title>
77
<meta name="viewport" content="width=device-width,initial-scale=1" />
8-
<link rel="stylesheet" type="text/css" href="stylesheets/game.css">
8+
9+
<link rel="stylesheet" type="text/css" href="stylesheets/styles.css">
910

1011
</head>
1112

1213
<body>
13-
14+
1415
<div class="game-board-window">
16+
<div id="loader"></div>
1517

1618
<div class="controls">
17-
<button type="button" class="controls-move">Move</button>
19+
<button type="button" class="controls-swapengine">Swap Engine</button>
1820
Player Score: <span class="controls-score">0</span>
1921
</div>
2022

21-
<div class="game-board"></div>
22-
23+
<div class="game-board-2d"></div>
24+
<div class="game-board-3d"></div>
2325
</div>
2426

25-
<a href="game3d.html">Play this in 3D!</a>
26-
27-
<!-- Custom Scripts -->
28-
<script src="scripts/game.js"></script>
27+
<!--
28+
Following image taken from https://sftextures.com/2015/12/04/grey-brick-wall-texture-seamless-modern-glossy-type/
29+
via Google Images with the filter: licensed for noncommercial reuse.
30+
31+
At some point, I'd use this to scale/skew when drawing planes, to give patterned fills to surfaces.
32+
33+
<img class="stone-bricks" src="images/grey-brick-texture-seamless-glassy-dirty-modern-concrete-wall-squared-pattern-smooth-surface-256x182.jpg" alt="Stone brick seamless pattern." />
34+
-->
35+
36+
<script>
37+
// See index.html for asset loader notes.
38+
window.assets = [
39+
'stylesheets/game.css',
40+
'scripts/game-engine-2d.js',
41+
'scripts/game-engine-3d.js',
42+
'scripts/game.js',
43+
];
44+
</script>
45+
<script src="scripts/asset-loader.js"></script>
2946

3047
</body>
3148

game3d.html

-41
This file was deleted.

index.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,7 @@ <h2>Check out what pull requests are up for selection</h2>
135135

136136
<div class="container" id="games">
137137
<h2>The 1PR Game</h2>
138-
<a href="/game.html" target="_blank">Play in 2D</a>
139-
<a href="/game3d.html" target="_blank">Play in 3D</a>
138+
<a href="game.html" target="_blank">Play Now</a>
140139
</div>
141140
</div>
142141

0 commit comments

Comments
 (0)