This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function random( min, max ) | |
| { | |
| min = min || 0; | |
| max = max || 1; | |
| var secs = (new Date()).getTime(); | |
| var rand = min + Math.round( Math.random( secs ) * (max - min) ); | |
| return rand; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var document = require("jsdom").jsdom(), | |
| window = document.createWindow(), | |
| jQuery = require('jquery').create(window), | |
| fs = require('fs'), | |
| script = document.createElement("script"); | |
| window.Canvas = require('canvas'); | |
| script.src = 'https://gist.github.com/raw/790339/3b0171c3e9b749bb93fff5d642eaa687f02939a5/jquery.flot.node-canvas.js'; | |
| script.onload = function () | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 39a40,41 | |
| > width: null, | |
| > height: null, | |
| 701c703,709 | |
| < var c = document.createElement('canvas'); | |
| --- | |
| > var c; | |
| > if (typeof Canvas !== "undefined"){ | |
| > c = new Canvas(width, height); | |
| > } else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [jfsiii@web165 node_flot]$ cat index.js | |
| var http = require('http'), ip = "127.0.0.1", port = 41205; | |
| http.createServer(function (req, res) | |
| { | |
| console.log('request received'); | |
| res.writeHead(200, {'Content-Type': 'text/plain'}); | |
| res.end('NodeJS on JSNo.de!\n'); | |
| }).listen(port); | |
| console.log('Server running at http://'+ip+':'+port+'/'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [jfsiii@web165 node_flot]$ uname -a | |
| Linux web165.webfaction.com 2.6.18-194.17.1.el5PAE #1 SMP Wed Sep 29 13:31:51 EDT 2010 i686 i686 i386 GNU/Linux | |
| [jfsiii@web165 node_flot]$ npm install canvas | |
| npm info it worked if it ends with ok | |
| npm info using npm@0.2.8-1 | |
| npm info using node@v0.2.5 | |
| npm info preinstall canvas@0.3.1 | |
| Checking for program g++ or c++ : /usr/bin/g++ | |
| Checking for program cpp : /usr/bin/cpp | |
| Checking for program ar : /usr/bin/ar |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [jfsiii@web165 node_flot]$ uname -a | |
| Linux web165.webfaction.com 2.6.18-194.17.1.el5PAE #1 SMP Wed Sep 29 13:31:51 EDT 2010 i686 i686 i386 GNU/Linux | |
| [jfsiii@web165 node_flot]$ npm update canvas | |
| npm info it worked if it ends with ok | |
| npm info using npm@0.2.8-1 | |
| npm info using node@v0.2.5 | |
| npm info updates canvas@0.3.2 | |
| npm info preupdate canvas@0.3.2 | |
| npm info fetch http://registry.npmjs.org/canvas/-/canvas-0.3.2.tgz | |
| npm info preinstall canvas@0.3.2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| console.log('flot init'); | |
| var document = require("jsdom").jsdom(), | |
| window = document.createWindow(), | |
| jQuery = require('jquery').create(window), | |
| fs = require('fs'), | |
| flot_location = 'http://jsno.de/javascripts/jquery.flot.svn.js', | |
| text_location = 'http://jsno.de/javascripts/jquery.flot.text.js'; | |
| window.Canvas = require('canvas'); | |
| loadScript(flot_location, function (){ loadScript(text_location, onPluginLoaded); }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var express = require('express'), | |
| app = module.exports = express.createServer(); | |
| app | |
| // Configuration | |
| .configure(function () { | |
| app.set('views', __dirname + '/views'); | |
| app.set('view engine', 'jade'); | |
| app.use(express.bodyDecoder()); | |
| app.use(express.methodOverride()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Javascript plotting library for jQuery, v. 0.6. | |
| * | |
| * Released under the MIT license by IOLA, December 2007. | |
| * | |
| */ | |
| // first an inline dependency, jquery.colorhelpers.js, we inline it here | |
| // for convenience | |
| /* Plugin for jQuery for working with colors. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Based on https://gist.github.com/583836 from http://stackoverflow.com/questions/3709391/node-js-base64-encode-a-downloaded-image-for-use-in-data-uri. | |
| * Neither that gist nor this one work for me in 0.2.x or 0.3.x. | |
| */ | |
| var request = require('request'), | |
| BufferList = require('bufferlist').BufferList, | |
| sys = require('sys'), | |
| bl = new BufferList(), | |
| url = 'http://nodejs.org/logo.png' | |
| ; |