Still needs score, losing state, and collision detection for walls.
If you have node installed, you can do this to play:
curl -Lo snake.js http://bit.ly/1jo72pa
#make sure you got the right file:
cat snake.js
~ :q 10:50 AM | |
Your shell has no parents. Are you sure you want to exit? (y/n)n |
app.get('/', function(req, res){ | |
db.keys('image:*:location', function(err,keys){ | |
if (err) { throw err; } | |
var offense = keys[Math.floor(Math.random()*keys.length)]; | |
var defense = keys[Math.floor(Math.random()*keys.length)]; | |
if (defense == offense) { | |
defense = keys[Math.floor(Math.random()*keys.length)]; | |
} | |
db.mget('image:' + offense + ':location', 'image:' + offense + ':rating', | |
'image:' + defense + ':location', 'image:' + defense + ':rating', |
var G = 100; | |
var vertex; | |
for (var i = 0; i < plane.geometry.vertices.length; i++) { | |
vertex = plane.geometry.vertices[i]; | |
var distance = Math.sqrt(Math.pow(vertex.x - sphere.position.x, 2) + Math.pow(vertex.y - -sphere.position.z, 2)); | |
var f = -(G * sphere.mass) / Math.pow(distance, 2); | |
vertex.z = f; | |
} |
~ → cat testConnection.js | |
var net = require('net'); | |
var url = require('url'); | |
// edit this | |
var conString = 'tcp://crypton_test_user:crypton_test_user_password@localhost:5432/crypton_test'; // default | |
var config = parse(conString); | |
console.log(config); |
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, (unsigned long)NULL), ^(void) { | |
char line[80]; | |
FILE *fr; | |
NSString *path = @"/path/to/long/file"; | |
struct stat info; | |
stat([path UTF8String], &info); | |
off_t lastSize = info.st_size; | |
fr = fopen([path UTF8String], "rt"); |
npm@1.2.10 /usr/local/lib/node_modules/npm | |
~ [ npm install -g express v0.8.18 ] 3:35 PM | |
npm info it worked if it ends with ok | |
npm info using npm@1.2.10 | |
npm info using node@v0.8.18 | |
npm ERR! TypeError: Object info has no method 'verbose' | |
npm ERR! at RegClient.regRequest [as request] (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:43:14) | |
npm ERR! at RegClient.get_ (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/get.js:112:8) | |
npm ERR! at RegClient.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/get.js:37:12) |
// include CryptoJS | |
var message = '12345678901234567890123456789012'; | |
var iv = CryptoJS.enc.Utf8.parse('1234567890123456'); | |
var challengeKey = 'fe8844b73775265aef8839bf39de68a5aec6b0f447034472e8ff937bd9046e91'; | |
var key = CryptoJS.enc.Hex.parse(challengeKey); | |
var challenge = CryptoJS.AES.encrypt(message, key, { | |
mode: CryptoJS.mode.CFB, | |
iv: iv |
/* | |
Example of achieving compatibility with AMD and standard CommonJS by putting boilerplate around the standard CommonJS module format: | |
*/ | |
(function(define){ | |
define(function(require,exports){ | |
// module contents | |
var dep1 = require("dep1"); | |
exports.someExportedFunction = function(){...}; | |
//... |
var module = (function() { | |
var _private = { | |
i:5, | |
get : function() { | |
console.log('current value:' + this.i); | |
}, | |
set : function( val ) { | |
this.i = val; | |
}, | |
run : function() { |