├── assets
├── shuffle.js
├── dimensions.png
├── grid.js
├── bundle.css
├── data.json
└── bundle.js
├── CNAME
├── .gitignore
├── badges
├── txrx-fail
│ ├── meta.json
│ └── txrx-fail.svg
├── end-tag
│ ├── meta.json
│ └── end-tag.svg
├── semicolon
│ ├── meta.json
│ └── semicolon.svg
├── txrx-fail-color
│ ├── meta.json
│ └── txrx-fail-color.svg
├── failed-print
│ ├── meta.json
│ └── FailedPrint.svg
├── magic-smoke
│ ├── meta.json
│ └── MagicSmoke.svg
├── solder-burn
│ ├── meta.json
│ └── solder-burn.svg
├── unevenground
│ ├── meta.json
│ └── unevenground.svg
├── close-parenthesis
│ ├── meta.json
│ └── close-parenthesis.svg
├── connectorflipup
│ ├── meta.json
│ └── connectorflipup.svg
├── emc-emissions-fail
│ ├── meta.json
│ └── emc-emissions-fail.svg
└── failed-to-pay-attention-in-class
│ ├── meta.json
│ └── failed-to-pay-attention-in-class.svg
├── template
├── meta.json
└── template.svg
├── package.json
├── index.html
└── README.md
/assets/shuffle.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/CNAME:
--------------------------------------------------------------------------------
1 | failbadges.com
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | .DS_Store
3 |
--------------------------------------------------------------------------------
/assets/dimensions.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ShawnHymel/fail-badges/HEAD/assets/dimensions.png
--------------------------------------------------------------------------------
/badges/txrx-fail/meta.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "TX RX Fail",
3 | "author": "Andrew Jaswa",
4 | "license": "CC0",
5 | "url": "https://raw.githubusercontent.com/ShawnHymel/fail-badges/gh-pages/badges/txrx-fail/txrx-fail.svg",
6 | "description": "TX RX labels are evil."
7 | }
8 |
--------------------------------------------------------------------------------
/badges/end-tag/meta.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "end-tag",
3 | "author": "Shawn Hymel",
4 | "license": "CC0",
5 | "url": "https://raw.githubusercontent.com/ShawnHymel/fail-badges/gh-pages/badges/end-tag/end-tag.svg",
6 | "description": "Your web page looks wonky because you forgot one of these."
7 | }
--------------------------------------------------------------------------------
/badges/semicolon/meta.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "semicolon",
3 | "author": "Shawn Hymel",
4 | "license": "CC0",
5 | "url": "https://raw.githubusercontent.com/ShawnHymel/fail-badges/gh-pages/badges/semicolon/semicolon.svg",
6 | "description": "The compiler yelled at you for forgetting a semicolon."
7 | }
--------------------------------------------------------------------------------
/badges/txrx-fail-color/meta.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "TX RX Fail (now in color!)",
3 | "author": "Glen Akins",
4 | "license": "CC0",
5 | "url": "https://raw.githubusercontent.com/ShawnHymel/fail-badges/gh-pages/badges/txrx-fail-color/txrx-fail-color.svg",
6 | "description": "TX RX labels are evil."
7 | }
8 |
--------------------------------------------------------------------------------
/template/meta.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "template",
3 | "author": "Yoshua Wuyts",
4 | "license": "CC BY 4.0",
5 | "url": "https://raw.githubusercontent.com/ShawnHymel/fail-badges/gh-pages/badges/template/template.svg",
6 | "description": "Template hex badge from github.com/terinjokes/StickersStandard"
7 | }
8 |
--------------------------------------------------------------------------------
/badges/failed-print/meta.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Failed Print",
3 | "author": "Techniack",
4 | "license": "CC BY 4.0",
5 | "url": "https://raw.githubusercontent.com/ShawnHymel/fail-badges/gh-pages/badges/failed-print/FailedPrint.svg",
6 | "description": "You forgot to level the bed and your print failed!"
7 | }
8 |
--------------------------------------------------------------------------------
/badges/magic-smoke/meta.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Magic Smoke",
3 | "author": "Techniack",
4 | "license": "CC BY 4.0",
5 | "url": "https://raw.githubusercontent.com/ShawnHymel/fail-badges/gh-pages/badges/magic-smoke/MagicSmoke.svg",
6 | "description": "You overvolted another board and let the magic smoke out!"
7 | }
8 |
--------------------------------------------------------------------------------
/badges/solder-burn/meta.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Solder Burn",
3 | "author": "Andrew Jaswa",
4 | "license": "CC0",
5 | "url": "https://raw.githubusercontent.com/ShawnHymel/fail-badges/gh-pages/badges/solder-burn/solder-burn.svg",
6 | "description": "For those times when you've burned your hand with a soldering iron."
7 | }
8 |
--------------------------------------------------------------------------------
/badges/unevenground/meta.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "unevenground",
3 | "author": "Tuomas Järvinen",
4 | "license": "CC0",
5 | "url": "https://raw.githubusercontent.com/ShawnHymel/fail-badges/gh-pages/badges/unevenground/unevenground.svg",
6 | "description": "Forget to link grounds on different pcbs",
7 | "sticker_url": "(optional)"
8 | }
--------------------------------------------------------------------------------
/badges/close-parenthesis/meta.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "close-parenthesis",
3 | "author": "Shawn Hymel",
4 | "license": "CC0",
5 | "url": "https://raw.githubusercontent.com/ShawnHymel/fail-badges/gh-pages/badges/close-parenthesis/close-parenthesis.svg",
6 | "description": "The compiler yelled at you for forgetting a close parenthesis."
7 | }
--------------------------------------------------------------------------------
/badges/connectorflipup/meta.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "connectorflipup",
3 | "author": "Tuomas Järvinen",
4 | "license": "CC0",
5 | "url": "https://raw.githubusercontent.com/ShawnHymel/fail-badges/gh-pages/badges/connectorflipup/connectorflipup.svg",
6 | "description": "Forgot to rotate the connector in the middle",
7 | "sticker_url": "(optional)"
8 | }
--------------------------------------------------------------------------------
/template/template.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/badges/emc-emissions-fail/meta.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "EMC emissions fail",
3 | "author": "Matt Venn",
4 | "license": "CC0",
5 | "url": "https://raw.githubusercontent.com/ShawnHymel/fail-badges/gh-pages/badges/emc-emissions-fail/emc-emissions-fail.svg",
6 | "description": "You take your great product to the compliance lab and they dash your hopes of an easy pass with this graph"
7 | }
8 |
--------------------------------------------------------------------------------
/badges/failed-to-pay-attention-in-class/meta.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "failed-to-pay-attention-in-class",
3 | "author": "Evan Spitler",
4 | "license": "CC0",
5 | "url": "https://raw.githubusercontent.com/ShawnHymel/fail-badges/gh-pages/badges/failed-to-pay-attention-in-class/failed-to-pay-attention-in-class.svg",
6 | "description": "Were you even paying attention, or were you just doodling on the desk?"
7 | }
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "failbadges",
3 | "version": "0.0.1",
4 | "description": "failbadges directory",
5 | "main": "grid.js",
6 | "scripts": {
7 | "build": "node build.js && browserify assets/grid.js -o assets/bundle.js",
8 | "test": "standard",
9 | "start": "wzrd assets/grid.js:assets/bundle.js"
10 | },
11 | "author": "",
12 | "license": "BSD",
13 | "dependencies": {
14 | "hex-grid": "^2.0.1",
15 | "jsonlint": "^1.6.2"
16 | },
17 | "devDependencies": {
18 | "browserify": "^7.0.0",
19 | "glob": "^6.0.4",
20 | "standard": "^5.4.1",
21 | "wzrd": "^1.4.0"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/assets/grid.js:
--------------------------------------------------------------------------------
1 | /* global $ */
2 | var grid = require('hex-grid')
3 |
4 | $.getJSON('assets/data.json', function (data) {
5 | var shuffled = shuffle(data)
6 | $.each(shuffled, function (key, val) {
7 | var img = $('
', {
8 | 'class': 'hex',
9 | 'src': val.url,
10 | 'title': val.name + ': ' + val.description,
11 | 'alt': val.name,
12 | })
13 |
14 | $('', {
15 | 'href': val.filename,
16 | 'target': '_blank'
17 | }).append(img).appendTo('#grid')
18 | })
19 |
20 | var hexes = document.querySelectorAll('.hex')
21 | var root = document.querySelector('#grid')
22 |
23 | function scan () {
24 | grid({ element: root, spacing: 4 }, hexes)
25 | }
26 |
27 | scan()
28 | window.addEventListener('resize', scan)
29 | window.addEventListener('load', scan)
30 | })
31 |
32 | function shuffle (array) {
33 | var currentIndex = array.length
34 | var temporaryValue
35 | var randomIndex
36 |
37 | // While there remain elements to shuffle...
38 | while (currentIndex !== 0) {
39 | // Pick a remaining element...
40 | randomIndex = Math.floor(Math.random() * currentIndex)
41 | currentIndex -= 1
42 |
43 | // And swap it with the current element.
44 | temporaryValue = array[currentIndex]
45 | array[currentIndex] = array[randomIndex]
46 | array[randomIndex] = temporaryValue
47 | }
48 |
49 | return array
50 | }
51 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | failbadges - hexagon sticker repository
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
29 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/assets/bundle.css:
--------------------------------------------------------------------------------
1 | body {
2 | background: #666;
3 | font-family: "Helvetica Neue",Helvetica;
4 | color: #909196;
5 | text-rendering: optimizeLegibility;
6 | -webkit-font-smoothing: antialiased;
7 | }
8 |
9 | .darknav {
10 | background-color: #1c1d27;
11 | width: 100%;
12 | height: 82px;
13 | position: absolute;
14 | top: 0;
15 | }
16 |
17 | #grid a { opacity: 1; }
18 | #grid a:hover { position: relative; top: -1px; }
19 | #grid a:active { position: relative; top: 1px; }
20 | #grid img { width: 181px; height: 209px; }
21 |
22 | .navbar {
23 | margin: 15px 0;
24 | }
25 |
26 | .navbar a,
27 | .navbar a:hover,
28 | .navbar a:active {
29 | color: #fff;
30 | }
31 |
32 | .navhr {
33 | border-bottom: solid 1px #353640;
34 | width: 100%;
35 | height: 1px;
36 | }
37 |
38 | @media(min-width:992px) {
39 | .main-content {
40 | padding: 0 100px;
41 | };
42 | }
43 |
44 | .main-content a,.main-content a:hover,.main-content a:visited,.main-content a:active,.main-content a:focus {
45 | color: #fff;
46 | opacity: .5;
47 | text-decoration: none;
48 | }
49 |
50 | .main-content a:hover,.main-content .selected {
51 | opacity: 1.0;
52 | }
53 |
54 | .main-content .splash {
55 | margin-top: 60px;
56 | margin-bottom: 60px;
57 | margin-right: 50px;
58 | font-family: "Helvetica Neue",Helvetica;
59 | }
60 |
61 | .main-content .splash .title {
62 | color: #fff;
63 | margin: 20px 0;
64 | font-size: 36px;
65 | font-weight: 300;
66 | }
67 |
68 | @media(max-width:570px) {
69 | .main-content .splash .title img {
70 | width: 90%;
71 | };
72 | }
73 |
74 | .main-content .splash .subtitle {
75 | font-size: 18px;
76 | font-weight: 400;
77 | }
78 |
79 | .main-content .splash .subtitle .bold, a.bold {
80 | color: #fff;
81 | opacity: 1;
82 | }
83 |
--------------------------------------------------------------------------------
/badges/semicolon/semicolon.svg:
--------------------------------------------------------------------------------
1 |
2 |
76 |
--------------------------------------------------------------------------------
/badges/end-tag/end-tag.svg:
--------------------------------------------------------------------------------
1 |
2 |
77 |
--------------------------------------------------------------------------------
/badges/close-parenthesis/close-parenthesis.svg:
--------------------------------------------------------------------------------
1 |
2 |
77 |
--------------------------------------------------------------------------------
/badges/failed-to-pay-attention-in-class/failed-to-pay-attention-in-class.svg:
--------------------------------------------------------------------------------
1 |
2 |
76 |
--------------------------------------------------------------------------------
/assets/data.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "name": "close-parenthesis",
4 | "author": "Shawn Hymel",
5 | "license": "CC0",
6 | "url": "https://raw.githubusercontent.com/ShawnHymel/fail-badges/gh-pages/badges/close-parenthesis/close-parenthesis.svg",
7 | "description": "The compiler yelled at you for forgetting a close parenthesis.",
8 | "filename": "badges/close-parenthesis/meta.json"
9 | },
10 | {
11 | "name": "connectorflipup",
12 | "author": "Tuomas Järvinen",
13 | "license": "CC0",
14 | "url": "https://raw.githubusercontent.com/ShawnHymel/fail-badges/gh-pages/badges/connectorflipup/connectorflipup.svg",
15 | "description": "Forgot to rotate the connector in the middle",
16 | "sticker_url": "(optional)",
17 | "filename": "badges/connectorflipup/meta.json"
18 | },
19 | {
20 | "name": "EMC emissions fail",
21 | "author": "Matt Venn",
22 | "license": "CC0",
23 | "url": "https://raw.githubusercontent.com/ShawnHymel/fail-badges/gh-pages/badges/emc-emissions-fail/emc-emissions-fail.svg",
24 | "description": "You take your great product to the compliance lab and they dash your hopes of an easy pass with this graph",
25 | "filename": "badges/emc-emissions-fail/meta.json"
26 | },
27 | {
28 | "name": "end-tag",
29 | "author": "Shawn Hymel",
30 | "license": "CC0",
31 | "url": "https://raw.githubusercontent.com/ShawnHymel/fail-badges/gh-pages/badges/end-tag/end-tag.svg",
32 | "description": "Your web page looks wonky because you forgot one of these.",
33 | "filename": "badges/end-tag/meta.json"
34 | },
35 | {
36 | "name": "Failed Print",
37 | "author": "Techniack",
38 | "license": "CC BY 4.0",
39 | "url": "https://raw.githubusercontent.com/ShawnHymel/fail-badges/gh-pages/badges/failed-print/FailedPrint.svg",
40 | "description": "You forgot to level the bed and your print failed!",
41 | "filename": "badges/failed-print/meta.json"
42 | },
43 | {
44 | "name": "Magic Smoke",
45 | "author": "Techniack",
46 | "license": "CC BY 4.0",
47 | "url": "https://raw.githubusercontent.com/ShawnHymel/fail-badges/gh-pages/badges/magic-smoke/MagicSmoke.svg",
48 | "description": "You overvolted another board and let the magic smoke out!",
49 | "filename": "badges/magic-smoke/meta.json"
50 | },
51 | {
52 | "name": "semicolon",
53 | "author": "Shawn Hymel",
54 | "license": "CC0",
55 | "url": "https://raw.githubusercontent.com/ShawnHymel/fail-badges/gh-pages/badges/semicolon/semicolon.svg",
56 | "description": "The compiler yelled at you for forgetting a semicolon.",
57 | "filename": "badges/semicolon/meta.json"
58 | },
59 | {
60 | "name": "Solder Burn",
61 | "author": "Andrew Jaswa",
62 | "license": "CC0",
63 | "url": "https://raw.githubusercontent.com/ShawnHymel/fail-badges/gh-pages/badges/solder-burn/solder-burn.svg",
64 | "description": "For those times when you've burned your hand with a soldering iron.",
65 | "filename": "badges/solder-burn/meta.json"
66 | },
67 | {
68 | "name": "TX RX Fail",
69 | "author": "Andrew Jaswa",
70 | "license": "CC0",
71 | "url": "https://raw.githubusercontent.com/ShawnHymel/fail-badges/gh-pages/badges/txrx-fail/txrx-fail.svg",
72 | "description": "TX RX labels are evil.",
73 | "filename": "badges/txrx-fail/meta.json"
74 | },
75 | {
76 | "name": "unevenground",
77 | "author": "Tuomas Järvinen",
78 | "license": "CC0",
79 | "url": "https://raw.githubusercontent.com/ShawnHymel/fail-badges/gh-pages/badges/unevenground/unevenground.svg",
80 | "description": "Forget to link grounds on different pcbs",
81 | "sticker_url": "(optional)",
82 | "filename": "badges/unevenground/meta.json"
83 | }
84 | ]
--------------------------------------------------------------------------------
/badges/failed-print/FailedPrint.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
42 |
--------------------------------------------------------------------------------
/badges/unevenground/unevenground.svg:
--------------------------------------------------------------------------------
1 |
2 |
136 |
--------------------------------------------------------------------------------
/badges/emc-emissions-fail/emc-emissions-fail.svg:
--------------------------------------------------------------------------------
1 |
2 |
129 |
--------------------------------------------------------------------------------
/badges/txrx-fail/txrx-fail.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/badges/solder-burn/solder-burn.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Fail Badges
2 |
3 | Ever wanted to wear your fails like a badge of honor? Proud that you burned your hand with a soldering iron? Got TX/RX mixed up?
4 |
5 | We're here for you, and we want to celebrate failures, because they're part of the learning process. We've all been there.
6 |
7 | Download the SVG's for printing or put them on your website!
8 |
9 | ## Badges
10 |
11 |
12 |
13 | The compiler yelled at you for forgetting a close parenthesis.
 |
14 | Forgot to rotate the connector in the middle
 |
15 | You take your great product to the compliance lab and they dash your hopes of an easy pass with this graph
 |
16 | Your web page looks wonky because you forgot one of these.
 |
17 |
18 |
19 |
20 | You forgot to level the bed and your print failed!
 |
21 | Were you even paying attention, or were you just doodling on the desk?
 |
22 | You overvolted another board and let the magic smoke out!
 |
23 | The compiler yelled at you for forgetting a semicolon.
 |
24 |
25 |
26 |
27 |
28 | For those times when you've burned your hand with a soldering iron.
 |
29 | TX RX labels are evil.
 |
30 | TX RX labels are evil.
 |
31 | Forget to link grounds on different pcbs
 |
32 |
33 |
34 |
35 | ## How to Print Badges
36 |
37 | TODO
38 |
39 | ## How to Add Badge to Website
40 |
41 | TODO
42 |
43 | ## How to Submit Your Own Design
44 |
45 | Badge designs must be in .SVG format and adhere to the [Hex Stickers Standard](https://github.com/terinjokes/StickersStandard). That way, they all have the same size and shape. Learn more about the hex sticker format [here](http://hexb.in/sticker.html).
46 |
47 | 
48 |
49 | Use a program like [Inkscape](https://github.com/terinjokes/StickersStandard) to create your design. We recommend starting with the [hex image template](https://raw.githubusercontent.com/ShawnHymel/fail-badges/gh-pages/badges/template/template.svg) found in the `badges/` directory as a base.
50 |
51 | * Make sure you own the rights to the image you are submitting!
52 | * Clone this repo
53 | * Create a new folder in the `badges/` directory with the name of your badge, using only lowercase letters, numbers, and hyphens
54 | * Give your .svg file a name using only lowercase letters, numbers, and hyphens
55 | * Add your .svg graphic and a meta.json file containing information about your design
56 |
57 | Here is a meta.json template:
58 |
59 | ```
60 | {
61 | "name": "txrx-fail",
62 | "author": "Shawn Hymel",
63 | "license": "CC0",
64 | "url": "https://raw.githubusercontent.com/ShawnHymel/fail-badges/gh-pages/badges/txrx-fail/txrx-fail.svg",
65 | "description": "Show that you've messed up the TX/RX wiring on a serial bus at least once!",
66 | "sticker_url": "(optional) add a url to an online store that will make and ship a sticker version of your badge"
67 | }
68 | ```
69 |
70 | Please be descriptive in the description! This should help people know what the badge represents.
71 |
72 | When done, your directory structure should look like this:
73 |
74 | ```
75 | fail-badges/
76 | |- badges/
77 | |--- my-badge/
78 | |----- meta.json
79 | |----- my-badge.svg
80 | |----- ...
81 | |--- ...
82 | |- README.md
83 | ```
84 |
85 | Make a pull request to this repo! See [this guide](https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request) for help on making pull requests.
86 |
87 | ## Resources
88 |
89 | Here are some tools that can help you automatically generate stickers:
90 |
91 | * Python: [hexsticker](https://github.com/fridex/hexsticker)
92 | * R: [hexSticer](https://github.com/GuangchuangYu/hexSticker)
93 |
94 | ## License and Credits
95 |
96 | See meta.json in each badge folder to view the license information for that particular sticker.
97 |
98 | Sticker specifications, repo layout, and much code credits go to [hexbin](http://hexb.in/).
99 |
--------------------------------------------------------------------------------
/assets/bundle.js:
--------------------------------------------------------------------------------
1 | (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o', {
9 | 'class': 'hex',
10 | 'src': val.url,
11 | 'title': val.name + ': ' + val.description,
12 | 'alt': val.name,
13 | })
14 |
15 | $('', {
16 | 'href': val.filename,
17 | 'target': '_blank'
18 | }).append(img).appendTo('#grid')
19 | })
20 |
21 | var hexes = document.querySelectorAll('.hex')
22 | var root = document.querySelector('#grid')
23 |
24 | function scan () {
25 | grid({ element: root, spacing: 4 }, hexes)
26 | }
27 |
28 | scan()
29 | window.addEventListener('resize', scan)
30 | window.addEventListener('load', scan)
31 | })
32 |
33 | function shuffle (array) {
34 | var currentIndex = array.length
35 | var temporaryValue
36 | var randomIndex
37 |
38 | // While there remain elements to shuffle...
39 | while (currentIndex !== 0) {
40 | // Pick a remaining element...
41 | randomIndex = Math.floor(Math.random() * currentIndex)
42 | currentIndex -= 1
43 |
44 | // And swap it with the current element.
45 | temporaryValue = array[currentIndex]
46 | array[currentIndex] = array[randomIndex]
47 | array[randomIndex] = temporaryValue
48 | }
49 |
50 | return array
51 | }
52 |
53 | },{"hex-grid":3}],2:[function(require,module,exports){
54 | module.exports = function () {
55 | for (var i = 0; i < arguments.length; i++) {
56 | if (arguments[i] !== undefined) return arguments[i];
57 | }
58 | };
59 |
60 | },{}],3:[function(require,module,exports){
61 | var inside = require('point-in-polygon');
62 | var defined = require('defined');
63 |
64 | module.exports = function (opts, hexes) {
65 | var rsize = dims(opts);
66 | var hsize = dims(isharray(hexes) ? hexes[0] : hexes);
67 | if (!isharray(hexes)) {
68 | var h = hexes;
69 | hexes = [];
70 | for (var i = 0; i < h.n; i++) hexes.push(h);
71 | }
72 | var spacing = defined(opts.spacing, 0);
73 | var offset = opts.offset;
74 | if (!offset && opts.element) {
75 | offset = {
76 | x: opts.element.offsetLeft,
77 | y: opts.element.offsetTop
78 | };
79 | }
80 | if (!offset) {
81 | offset = {
82 | x: defined(opts.offsetLeft, 0),
83 | y: defined(opts.offsetTop, 0)
84 | };
85 | }
86 | var initRow = defined(opts.initRow, 0);
87 | initRow = parseInt(initRow, 10);
88 | if (initRow > 1) initRow = 1;
89 | if (initRow < 0) initRow = 0;
90 |
91 | var x = (initRow === 1) ? (hsize.width / 2) + (spacing / 2) : 0;
92 | var y = 0;
93 | var row = initRow;
94 | var results = [], points = [];
95 | for (var i = 0; i < hexes.length; i++) {
96 | var hex = hexes[i];
97 | if (hex.style) {
98 | hex.style.position = 'absolute';
99 | hex.style.left = x;
100 | hex.style.top = y;
101 | }
102 | results.push({ x: x, y: y });
103 |
104 | var hw = hsize.width / 2, hh = hsize.height / 2;
105 | var cx = x + hw, cy = y + hh;
106 | var pts = [
107 | [ cx, cy - hh ],
108 | [ cx + hw, cy - hh / 2 ],
109 | [ cx + hw, cy + hh / 2 ],
110 | [ cx, cy + hh ],
111 | [ cx - hw, cy + hh / 2 ],
112 | [ cx - hw, cy - hh / 2 ]
113 | ];
114 | points.push(pts);
115 |
116 | x += hsize.width + spacing;
117 | if (x > rsize.width - hsize.width) {
118 | y += Math.floor(hsize.height * 3/4) + spacing;
119 | row ++;
120 | x = (row % 2 ? (hsize.width / 2) + (spacing / 2) : 0);
121 | }
122 | }
123 | var res = {
124 | grid: results,
125 | points: points,
126 | lookupIndex: function (x, y) {
127 | var pt = [ x - offset.x, y - offset.y ];
128 | for (var i = 0; i < points.length; i++) {
129 | if (inside(pt, points[i])) return i;
130 | }
131 | return -1;
132 | },
133 | lookup: function (x, y) {
134 | var i = res.lookupIndex(x, y);
135 | return i >= 0 ? hexes[i] : undefined;
136 | }
137 | };
138 | return res;
139 | };
140 |
141 | function dims (opts) {
142 | var s = opts;
143 | if (opts.width || opts.height) {
144 | s = opts;
145 | }
146 | else if (opts.element) {
147 | s = window.getComputedStyle(opts.element);
148 | }
149 | else if (typeof window !== 'undefined' && window.getComputedStyle) {
150 | s = window.getComputedStyle(opts);
151 | }
152 | return {
153 | width: parseInt(s.width),
154 | height: parseInt(s.height)
155 | };
156 | }
157 |
158 | function isharray (xs) {
159 | return xs && typeof xs === 'object' && typeof xs.length === 'number';
160 | }
161 |
162 | },{"defined":2,"point-in-polygon":4}],4:[function(require,module,exports){
163 | module.exports = function (point, vs) {
164 | // ray-casting algorithm based on
165 | // http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
166 |
167 | var x = point[0], y = point[1];
168 |
169 | var inside = false;
170 | for (var i = 0, j = vs.length - 1; i < vs.length; j = i++) {
171 | var xi = vs[i][0], yi = vs[i][1];
172 | var xj = vs[j][0], yj = vs[j][1];
173 |
174 | var intersect = ((yi > y) != (yj > y))
175 | && (x < (xj - xi) * (y - yi) / (yj - yi) + xi);
176 | if (intersect) inside = !inside;
177 | }
178 |
179 | return inside;
180 | };
181 |
182 | },{}]},{},[1]);
183 |
--------------------------------------------------------------------------------
/badges/connectorflipup/connectorflipup.svg:
--------------------------------------------------------------------------------
1 |
2 |
240 |
--------------------------------------------------------------------------------
/badges/magic-smoke/MagicSmoke.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
235 |
--------------------------------------------------------------------------------
/badges/txrx-fail-color/txrx-fail-color.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------