Loading TODO.md +3 −14 Original line number Diff line number Diff line # TODO * cache headers for static assets (and on document GET) # TODO for OSS * tests * fix that chrome bug where it loads the doc twice * expand extension map * kick expiration back by increment on each view * Add file extensions ourselves to push state * Proper markdown highlighting * Better about page text * Collapse CSS rules to get rid of the #key .box1 nonsense * add feedback for errors to UI - esp. too long * make sure file store still functions appropriately # shared version only * some way to do announcements easily (and use for ads) * start using CDNs for most assets (optional) # with brian's design * add feedback for errors to UI - esp. too long * add link to about page * copy URL to clipboard button about.md +18 −2 Original line number Diff line number Diff line # Haste <b>Sharing code is a good thing</b>, and it should be _really_ easy to do it. Sharing code is a good thing, and it should be _really_ easy to do it. A lot of times, I want to show you something I'm seeing - and that's where we use pastebins. Haste is the prettiest, easist to use pastebin ever made. ## Basic Usage Type what you want me to see, click "Save", and then copy the URL. Send that URL to someone and they'll see what you see. ## From the Console Most of the time I want to show you some text, its coming from my current console session. Loading @@ -21,6 +26,17 @@ been conveniently copied to your clipboard. That's all there is to that, and you can install it with `gem install haste` right now. ## Duration Pastes will stay for 30 days from their last view. ## Privacy While the contents of hastebin.com are not directly crawled by any search robot that obeys "robots.txt", there should be no great expectation of privacy. Post things at your own risk. Not responsible for any loss of data or removed pastes. ## Author John Crepezzi <john.crepezzi@gmail.com> Code by John Crepezzi <john.crepezzi@gmail.com> Key Design by Brian Dawson config.js +3 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,9 @@ "maxLength": 400000, "cacheStaticAssets": false, "staticMaxAge": 86400, "recompressStaticAssets": true, "logging": [ { Loading lib/document_handler.js +2 −2 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ var DocumentHandler = function(options) { }; // Handle retrieving a document DocumentHandler.prototype.handleGet = function(key, response) { DocumentHandler.prototype.handleGet = function(key, response, skipExpire) { this.store.get(key, function(ret) { if (ret) { winston.verbose('retrieved document', { key: key }); Loading @@ -23,7 +23,7 @@ DocumentHandler.prototype.handleGet = function(key, response) { response.writeHead(404, { 'content-type': 'application/json' }); response.end(JSON.stringify({ message: 'document not found' })); } }); }, skipExpire); }; // Handle adding a new Document Loading lib/file_document_store.js +10 −2 Original line number Diff line number Diff line Loading @@ -9,10 +9,11 @@ var hashlib = require('hashlib'); var FileDocumentStore = function(options) { this.basePath = options.path || './data'; this.expire = options.expire; }; // Save data in a file, key as md5 - since we don't know what we could be passed here FileDocumentStore.prototype.set = function(key, data, callback) { FileDocumentStore.prototype.set = function(key, data, callback, skipExpire) { try { var _this = this; fs.mkdir(this.basePath, '700', function() { Loading @@ -22,6 +23,9 @@ FileDocumentStore.prototype.set = function(key, data, callback) { } else { callback(true); if (_this.expire && !skipExpire) { winston.warn('file store cannot set expirations on keys'); } } }); }); Loading @@ -31,13 +35,17 @@ FileDocumentStore.prototype.set = function(key, data, callback) { }; // Get data from a file from key FileDocumentStore.prototype.get = function(key, callback) { FileDocumentStore.prototype.get = function(key, callback, skipExpire) { var _this = this; fs.readFile(this.basePath + '/' + hashlib.md5(key), 'utf8', function(err, data) { if (err) { callback(false); } else { callback(data); if (_this.expire && !skipExpire) { winston.warn('file store cannot set expirations on keys'); } } }); }; Loading Loading
TODO.md +3 −14 Original line number Diff line number Diff line # TODO * cache headers for static assets (and on document GET) # TODO for OSS * tests * fix that chrome bug where it loads the doc twice * expand extension map * kick expiration back by increment on each view * Add file extensions ourselves to push state * Proper markdown highlighting * Better about page text * Collapse CSS rules to get rid of the #key .box1 nonsense * add feedback for errors to UI - esp. too long * make sure file store still functions appropriately # shared version only * some way to do announcements easily (and use for ads) * start using CDNs for most assets (optional) # with brian's design * add feedback for errors to UI - esp. too long * add link to about page * copy URL to clipboard button
about.md +18 −2 Original line number Diff line number Diff line # Haste <b>Sharing code is a good thing</b>, and it should be _really_ easy to do it. Sharing code is a good thing, and it should be _really_ easy to do it. A lot of times, I want to show you something I'm seeing - and that's where we use pastebins. Haste is the prettiest, easist to use pastebin ever made. ## Basic Usage Type what you want me to see, click "Save", and then copy the URL. Send that URL to someone and they'll see what you see. ## From the Console Most of the time I want to show you some text, its coming from my current console session. Loading @@ -21,6 +26,17 @@ been conveniently copied to your clipboard. That's all there is to that, and you can install it with `gem install haste` right now. ## Duration Pastes will stay for 30 days from their last view. ## Privacy While the contents of hastebin.com are not directly crawled by any search robot that obeys "robots.txt", there should be no great expectation of privacy. Post things at your own risk. Not responsible for any loss of data or removed pastes. ## Author John Crepezzi <john.crepezzi@gmail.com> Code by John Crepezzi <john.crepezzi@gmail.com> Key Design by Brian Dawson
config.js +3 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,9 @@ "maxLength": 400000, "cacheStaticAssets": false, "staticMaxAge": 86400, "recompressStaticAssets": true, "logging": [ { Loading
lib/document_handler.js +2 −2 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ var DocumentHandler = function(options) { }; // Handle retrieving a document DocumentHandler.prototype.handleGet = function(key, response) { DocumentHandler.prototype.handleGet = function(key, response, skipExpire) { this.store.get(key, function(ret) { if (ret) { winston.verbose('retrieved document', { key: key }); Loading @@ -23,7 +23,7 @@ DocumentHandler.prototype.handleGet = function(key, response) { response.writeHead(404, { 'content-type': 'application/json' }); response.end(JSON.stringify({ message: 'document not found' })); } }); }, skipExpire); }; // Handle adding a new Document Loading
lib/file_document_store.js +10 −2 Original line number Diff line number Diff line Loading @@ -9,10 +9,11 @@ var hashlib = require('hashlib'); var FileDocumentStore = function(options) { this.basePath = options.path || './data'; this.expire = options.expire; }; // Save data in a file, key as md5 - since we don't know what we could be passed here FileDocumentStore.prototype.set = function(key, data, callback) { FileDocumentStore.prototype.set = function(key, data, callback, skipExpire) { try { var _this = this; fs.mkdir(this.basePath, '700', function() { Loading @@ -22,6 +23,9 @@ FileDocumentStore.prototype.set = function(key, data, callback) { } else { callback(true); if (_this.expire && !skipExpire) { winston.warn('file store cannot set expirations on keys'); } } }); }); Loading @@ -31,13 +35,17 @@ FileDocumentStore.prototype.set = function(key, data, callback) { }; // Get data from a file from key FileDocumentStore.prototype.get = function(key, callback) { FileDocumentStore.prototype.get = function(key, callback, skipExpire) { var _this = this; fs.readFile(this.basePath + '/' + hashlib.md5(key), 'utf8', function(err, data) { if (err) { callback(false); } else { callback(data); if (_this.expire && !skipExpire) { winston.warn('file store cannot set expirations on keys'); } } }); }; Loading