├── .gitignore
├── cat.jpg
├── collaborators.md
├── index.js
├── package.json
├── picture.png
├── readme.md
└── test.js
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
--------------------------------------------------------------------------------
/cat.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/max-mapper/cat-picture/b385eaaca00ce6b8832a8bdedeaca40717979edb/cat.jpg
--------------------------------------------------------------------------------
/collaborators.md:
--------------------------------------------------------------------------------
1 | ## Collaborators
2 |
3 | cat-picture is only possible due to the excellent work of the following collaborators:
4 |
5 |
8 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | var fs = require('fs')
2 | var cat = fs.readFileSync(__dirname + '/cat.jpg', 'hex')
3 | cat = new Buffer(cat.toString(), 'hex').toString('base64')
4 | cat = 'data:image/jpeg;base64,' + cat
5 | var img = document.createElement('img')
6 | img.setAttribute('src', cat)
7 | img.setAttribute('class', 'cat-picture')
8 | document.body.appendChild(img)
9 | module.exports = img
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "cat-picture",
3 | "version": "5.1.2",
4 | "description": "makes a cat appear on your web site",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "browserify test.js"
8 | },
9 | "author": "max ogden",
10 | "license": "BSD",
11 | "dependencies": {
12 | "brfs": "^1.0.0"
13 | },
14 | "browserify": {
15 | "transform": [
16 | "brfs"
17 | ]
18 | },
19 | "repository": {
20 | "type": "git",
21 | "url": "https://github.com/maxogden/cat-picture.git"
22 | },
23 | "bugs": {
24 | "url": "https://github.com/maxogden/cat-picture/issues"
25 | },
26 | "homepage": "https://github.com/maxogden/cat-picture",
27 | "testling": {
28 | "files": "test.js",
29 | "browsers": [
30 | "ie/8..latest",
31 | "firefox/17..latest",
32 | "firefox/nightly",
33 | "chrome/22..latest",
34 | "chrome/canary",
35 | "opera/12..latest",
36 | "opera/next",
37 | "safari/5.1..latest",
38 | "ipad/6.0..latest",
39 | "iphone/6.0..latest",
40 | "android-browser/4.2..latest"
41 | ]
42 | },
43 | "devDependencies": {
44 | "browserify": "^3.32.1",
45 | "tape": "^2.10.2"
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/picture.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/max-mapper/cat-picture/b385eaaca00ce6b8832a8bdedeaca40717979edb/picture.png
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | # cat-picture
2 |
3 | makes a cat picture appear on your web site
4 |
5 | simply `require('cat-picture')` to make it happen
6 |
7 | [](https://ci.testling.com/maxogden/cat-picture)
8 |
9 | ## usage
10 |
11 | ```js
12 | require('cat-picture')
13 | ```
14 |
15 | ## demo
16 |
17 | [try it on requirebin](http://requirebin.com/?gist=9522894)
18 |
19 | does this:
20 |
21 | 
22 |
23 |
--------------------------------------------------------------------------------
/test.js:
--------------------------------------------------------------------------------
1 | var test = require('tape')
2 | test('loads a cat', function(t) {
3 | t.notOk(!!document.querySelector('.cat-picture'))
4 | require('./')
5 | t.ok(!!document.querySelector('.cat-picture'))
6 | t.end()
7 | })
--------------------------------------------------------------------------------