Skip to content

Instantly share code, notes, and snippets.

@1wheel
Created December 22, 2016 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 1wheel/5783891c1d922db04c7513bb9dc88291 to your computer and use it in GitHub Desktop.
Save 1wheel/5783891c1d922db04c7513bb9dc88291 to your computer and use it in GitHub Desktop.
screenshot-commits
node_modules
commit f6d0e93cc86e5055cfcd5d989d2063deb9660e11
Author: Adam Pearce <1wheel@gmail.com>
Date: Wed Dec 21 20:41:13 2016 -0500
1966
commit 3b7859dedc66c18553739ec6e5c7c2773b70f350
Author: Adam Pearce <1wheel@gmail.com>
Date: Wed Dec 21 18:07:46 2016 -0500
no img
commit 3ddccf69125dda8b433f22031f5b3032bc911988
Author: Adam Pearce <1wheel@gmail.com>
Date: Wed Dec 21 17:24:46 2016 -0500
mobile
commit 52a285856df43d2be5e6de0718a2e7d0196dabbf
Author: Adam Pearce <1wheel@gmail.com>
Date: Wed Dec 21 17:20:55 2016 -0500
peroids
commit 6f1273c2bcf0dacbb76996dacdd6c2ae01eb5015
Author: Adam Pearce <1wheel@gmail.com>
Date: Wed Dec 21 17:18:20 2016 -0500
lines
commit 10e66d2a86a25c51f8bb8fd6c591f2a8cc4c6485
Author: Adam Pearce <1wheel@gmail.com>
Date: Wed Dec 21 17:16:18 2016 -0500
css
commit 4d0f4aa9d1701ae35c2a323a418ad4693f4e82db
Author: Adam Pearce <1wheel@gmail.com>
Date: Wed Dec 21 16:55:38 2016 -0500
mobile cards
commit c55c7db739772308d8e58bd9276b0df5da9a468f
Author: Adam Pearce <1wheel@gmail.com>
Date: Wed Dec 21 16:03:39 2016 -0500
preview eh
commit 5c7ad399978c2368d782277242b074a4b738014f
Author: Adam Pearce <1wheel@gmail.com>
Date: Wed Dec 21 15:58:52 2016 -0500
image path
commit b43ad196759c5e400156210cfe32e132d2e1f657
Author: Adam Pearce <1wheel@gmail.com>
Date: Wed Dec 21 15:51:11 2016 -0500
changes pointer pos
commit 368fdac4b253dea855c8c9596ba44d6e63cefcc9
Author: Adam Pearce <1wheel@gmail.com>
Date: Wed Dec 21 15:47:42 2016 -0500
peroids
commit 4963d5205097572de235178280a310708091147f
Author: Adam Pearce <1wheel@gmail.com>
Date: Wed Dec 21 15:47:17 2016 -0500
adds note
commit ba6f68b4389195c634029bb1af64b696a89718e8
Author: Adam Pearce <1wheel@gmail.com>
Date: Wed Dec 21 15:42:14 2016 -0500
build
commit f9e85655676fe2bb2a32baeca503302ccfb00b4e
Author: Adam Pearce <1wheel@gmail.com>
Date: Wed Dec 21 15:13:47 2016 -0500
paddings
commit 61763c5a34b9aba859f2a35576addaa45861d77d
Author: Adam Pearce <1wheel@gmail.com>
Date: Wed Dec 21 15:01:20 2016 -0500
hair
commit 6856c80a09f344a5659ff56f9a25b1d187625e5b
Author: Adam Pearce <1wheel@gmail.com>
Date: Wed Dec 21 14:52:24 2016 -0500
trump heads
commit 4671e08d54567825635ff0539b3f906b74d37ffe
Author: Adam Pearce <1wheel@gmail.com>
Date: Wed Dec 21 14:44:41 2016 -0500
data update
commit d076bb6f09031fc52e19d607d94331294a7d19bb
Author: Adam Pearce <1wheel@gmail.com>
Date: Wed Dec 21 14:33:35 2016 -0500
mobile anno
commit 36e1febeb5dfe380e7d67c1d0e95eca489efd9bd
Author: Adam Pearce <1wheel@gmail.com>
Date: Wed Dec 21 14:21:10 2016 -0500
word wrap
commit 97bbdaa016d834f88b85b51afcdc8adf46070673
Author: Adam Pearce <1wheel@gmail.com>
Date: Wed Dec 21 13:47:33 2016 -0500
mobile
commit f89adf61b6ac7ac2d65366cd991b5784bff1cc77
Author: Adam Pearce <1wheel@gmail.com>
Date: Wed Dec 21 13:27:44 2016 -0500
mobile cards
commit 5d27a65ce7711399c451813ef85a8c755e2f6601
Author: Adam Pearce <1wheel@gmail.com>
Date: Wed Dec 21 10:52:45 2016 -0500
anno tweaks
commit 731aa0a8446012423b6cafe3ee74f10b89424281
Author: Adam Pearce <1wheel@gmail.com>
Date: Wed Dec 21 10:45:56 2016 -0500
build
commit 23849b246f72228c47a5e72590d6d4a30d2b72e3
Author: Adam Pearce <1wheel@gmail.com>
Date: Tue Dec 20 16:46:30 2016 -0500
resizeable
commit 63159ebca8cac53c667b88a8fff5fd5da076efdf
Author: Adam Pearce <1wheel@gmail.com>
Date: Tue Dec 20 16:43:38 2016 -0500
reagan anno
commit 45c1d4e69cd22e8e2507122c0b70cb6a4faa96f1
Author: Adam Pearce <1wheel@gmail.com>
Date: Tue Dec 20 15:37:23 2016 -0500
build
commit ece731e24eb427607dbef2ae2172de3173732d1b
Author: Adam Pearce <1wheel@gmail.com>
Date: Tue Dec 20 15:30:15 2016 -0500
lines
commit 983ee5aa3fd699aaedc05456c2d72f1a2e542047
Author: Adam Pearce <1wheel@gmail.com>
Date: Tue Dec 20 15:20:55 2016 -0500
left
commit ca05a13696fe73b1a5c8266c43f75b17aefafd7f
Author: Adam Pearce <1wheel@gmail.com>
Date: Tue Dec 20 15:13:38 2016 -0500
adds post office dot
commit d7924c67756c83a8edda62b9832d6aa68f6d3454
Author: Adam Pearce <1wheel@gmail.com>
Date: Tue Dec 20 15:07:17 2016 -0500
begie
commit 41b33bde96ddb5257f90325124fd600ad7dad903
Author: Adam Pearce <1wheel@gmail.com>
Date: Tue Dec 20 14:25:33 2016 -0500
build
commit 8c487f5c5ac3be60487c7e2de1d62f1d1fa8d91b
Author: Adam Pearce <1wheel@gmail.com>
Date: Tue Dec 20 14:24:23 2016 -0500
cards
commit b25798a0a5a3d7f3f2becd6257ab2e2ea655ab87
Author: Adam Pearce <1wheel@gmail.com>
Date: Tue Dec 20 14:17:28 2016 -0500
cards
commit e676d1f3cb95b6f489a81aff5fc6669d99020c9a
Author: Adam Pearce <1wheel@gmail.com>
Date: Tue Dec 20 12:35:52 2016 -0500
dots
commit d7c6192ef609a99cfcca550e46ec5d0959b3d481
Author: Adam Pearce <1wheel@gmail.com>
Date: Tue Dec 20 12:34:34 2016 -0500
fixes text pos
commit 3e5e3c540518dfb88ca256049c5455b3e0118b5e
Author: Adam Pearce <1wheel@gmail.com>
Date: Tue Dec 20 12:33:15 2016 -0500
no lorem
commit eb5b30531e7bc609fae5fa075c191bdc252793c8
Author: Adam Pearce <1wheel@gmail.com>
Date: Mon Dec 19 18:32:44 2016 -0500
workdds
commit 4943439e3646c7ac32ca15e62c842e5eba31510f
Author: Adam Pearce <1wheel@gmail.com>
Date: Mon Dec 19 17:45:38 2016 -0500
moblie
commit a954dd81877459c0fb010b715c65b35ef019058c
Author: Adam Pearce <1wheel@gmail.com>
Date: Mon Dec 19 17:34:59 2016 -0500
build
commit 21be4b5d070aab31e88cd8297e05f59f7c19b2da
Author: Adam Pearce <1wheel@gmail.com>
Date: Mon Dec 19 17:08:11 2016 -0500
annons
commit 4ef1bfc9f15300404962d6ff7ef90c9e49c11d0e
Author: Adam Pearce <1wheel@gmail.com>
Date: Mon Dec 19 17:03:24 2016 -0500
anno pos
commit 810099d80b568b714f905da0047f28fccda725f5
Author: Adam Pearce <1wheel@gmail.com>
Date: Mon Dec 19 16:25:22 2016 -0500
red blue
commit 6c8edc06184dbf5256b02157c184fb9a33dc2a1b
Author: Adam Pearce <1wheel@gmail.com>
Date: Mon Dec 19 16:17:05 2016 -0500
area
commit f82b53a0d690d003d23e4c54b376f1cb68739f53
Author: Adam Pearce <1wheel@gmail.com>
Date: Mon Dec 19 15:54:41 2016 -0500
x scale
commit 5ef1e3ce761f12dbe9ca159e22cac874ac86dcc6
Author: Adam Pearce <1wheel@gmail.com>
Date: Mon Dec 19 15:51:52 2016 -0500
starts at 75
commit d5ebfac38f260849b999ceb6626c449bedf92c26
Author: Adam Pearce <1wheel@gmail.com>
Date: Mon Dec 19 15:40:17 2016 -0500
uggg
commit b77424ad6ce4836a9d69f2763061c33f8fffc416
Author: Adam Pearce <1wheel@gmail.com>
Date: Mon Dec 19 15:29:23 2016 -0500
desktop and mobile working
commit e91728f83f4d3690f608b17a8ce6e5aeafa128bb
Author: Adam Pearce <1wheel@gmail.com>
Date: Mon Dec 19 14:14:53 2016 -0500
mobile labels
commit df75c5aaef06f70bed6cfa32a3bad3321baf0efd
Author: Adam Pearce <1wheel@gmail.com>
Date: Mon Dec 19 12:00:09 2016 -0500
rotate
commit 9df099f3b7971c973a5c5bb3dfb946994ab1656e
Author: Adam Pearce <1wheel@gmail.com>
Date: Fri Dec 16 18:15:32 2016 -0500
epa
commit 0ba65eac7e4fa7582edc4fb214a0bc4d11ff3ae7
Author: Adam Pearce <1wheel@gmail.com>
Date: Fri Dec 16 17:03:13 2016 -0500
no cop
commit 4d43a798b2d074eed0ab0e222d1b6114680094cf
Author: Adam Pearce <1wheel@gmail.com>
Date: Fri Dec 16 16:45:08 2016 -0500
cpi
commit ea7365862867db06cb691dee860661a60a8ac50d
Author: Adam Pearce <1wheel@gmail.com>
Date: Thu Dec 15 18:20:24 2016 -0500
words
commit af7912c5ed805074588518049b7646af7a137e91
Author: Adam Pearce <1wheel@gmail.com>
Date: Thu Dec 15 11:02:56 2016 -0500
reorder
commit cc3fc2c172fc576561cec355ea1486ec3eea45ed
Author: Adam Pearce <1wheel@gmail.com>
Date: Thu Dec 15 10:55:37 2016 -0500
spelling
commit 584c5c7aa1a4e5857b68bcaf1b891f93a62d5516
Author: Adam Pearce <1wheel@gmail.com>
Date: Wed Dec 14 19:16:38 2016 -0500
cab
commit 008077570bbc59698d6cf3df070edb5718edb2f1
Author: Adam Pearce <1wheel@gmail.com>
Date: Wed Dec 14 16:05:35 2016 -0500
init
{
"name": "screenshot-history",
"version": "1.0.0",
"description": "",
"main": "script.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"d3": "^4.4.0",
"indian-ocean": "^2.0.1",
"nightmare": "^2.9.0",
"nightmare-screenshot": "^1.0.0"
}
}
var Nightmare = require('nightmare')
var Screenshot = require('nightmare-screenshot')
var d3 = require('d3')
var io = require('indian-ocean')
var fs = require('fs')
var baseURL = 'http://newsdev.ec2.nytimes.com/preview/2016-20-20-cabinet-removal/master@'
// Nightmare.action('screenshotSelector', function (path, selector, done) {
// console.log('.screenshotSelector()');
// if (typeof selector === 'function') {
// done = selector;
// selector = path;
// path = undefined;
// };
// var self = this;
// this.evaluate_now(function (selector) {
// var element = document.querySelector(selector);
// if (element) {
// var rect = element.getBoundingClientRect();
// return {
// x: Math.round(rect.left),
// y: Math.round(rect.top),
// width: Math.round(rect.width),
// height: Math.round(rect.height)
// };
// }
// }, function (a, clip) {
// console.log(clip)
// if (!clip) {
// throw new Error('invalid selector "' + selector + '"');
// }
// self
// .screenshot(path, clip)
// done()
// // self.child.once('screenshot', function (img) {
// // var buf = new Buffer(img.data);
// // console.log('.screenshotSelector() captured with length %s', buf.length);
// // path ? fs.writeFile(path, buf, done) : done(null, buf);
// // });
// // self.child.emit('screenshot', path, clip);
// console.log('done')
// }, selector);
// })
var commits = fs.readFileSync('commits.txt', 'utf-8').split('commit ')
.filter(d => d)
.reverse()
.filter((d, i) => i > 0)
.map((d, i) => ({i: d3.format('03')(i), sha: d.split('\n')[0]}))
var commit = commits[10]
var Nightmare = require('nightmare');
var Screenshot = require('nightmare-screenshot');
var nightmare = new Nightmare({show: true});
nightmare
.goto(baseURL + commit.sha)
.use(Screenshot.screenshotSelector(__dirname + `/img/${commit.i}.png`, 'body'))
.then(function(){
console.log('done')
})
// nightmare.run();
console.log('hi')
var q = d3.queue(1)
commits.forEach(function(commit){
return
q.defer(function(cb){
console.log('starting ', commit.i)
// var nightmare = new Nightmare({ show: false });
var nightmare = new Nightmare();
nightmare.goto(baseURL + commit.sha)
nightmare.use(Screenshot.screenshotSelector(__dirname + `/img/${commit.i}.png`, '.g-g-chart'))
// .wait(2000)
// .evaluate(function(){
// var element = document.querySelector('.g-g-chart');
// if (element) {
// var rect = element.getBoundingClientRect();
// return {
// x: Math.round(rect.left),
// y: Math.round(rect.top),
// width: Math.round(rect.width),
// height: Math.round(rect.height)
// };
// }
// })
// .then(function(result){
// console.log(result)
// })
// // .use(Screenshot.screenshotSelector(__dirname + `/img/${commit.i}.png`, '.g-g-chart'))
// // .screenshotSelector(__dirname + `/img/${commit.i}.png`, '.g-g-chart')
// .end()
// // .then(function (result) {
// // cb()
// // })
// .catch(function (error) {
// console.error('Search failed:', error);
// });
})
})
q.awaitAll(function(err){
// console.log(allUrls)
// io.writeDataSync(__dirname + '/out.json')
})
// https://github.com/segmentio/nightmare/pull/358
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment