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 currentFrame = 0; | |
setInterval(function() { | |
currentFrame++; | |
if (currentFrame % 3 == 0) { | |
currentFrame = 0; | |
// redraw every 150 ms, but change animation every 450 ms | |
app.graphics.globalAnimationFrame = !app.graphics.globalAnimationFrame; | |
app.player.killIfNpcNearby(); | |
} | |
app.environment.map.render(currentFrame === 0); |
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
initialize: function() { | |
var view = app.graphics.viewport; | |
view.WIDTH_TILE = Math.floor($(window).width() / app.graphics.TILE_WIDTH_PIXEL); | |
view.HEIGHT_TILE = Math.floor($(window).height() / app.graphics.TILE_HEIGHT_PIXEL); | |
view.WIDTH_PIXEL = app.graphics.viewport.WIDTH_TILE * app.graphics.TILE_WIDTH_PIXEL; | |
view.HEIGHT_PIXEL = app.graphics.viewport.HEIGHT_TILE * app.graphics.TILE_HEIGHT_PIXEL; | |
view.PLAYER_OFFSET_TOP_TILE = Math.floor(view.HEIGHT_TILE / 2); | |
view.PLAYER_OFFSET_LEFT_TILE = Math.floor(view.WIDTH_TILE / 2) + 1; | |
$('#gamefield').append('<canvas id="map" width="' + view.WIDTH_PIXEL + '" height="' + view.HEIGHT_PIXEL + '"></canvas>'); | |
$('#page, #nametags').width(view.WIDTH_PIXEL).height(view.HEIGHT_PIXEL); |
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
drawTile: function(x, y, tile) { | |
var x_pixel = x * app.graphics.TILE_WIDTH_PIXEL; | |
var y_pixel = y * app.graphics.TILE_HEIGHT_PIXEL; | |
if (tile == null || isNaN(tile[0])) { | |
return; | |
} | |
app.graphics.handle.drawImage( | |
app.graphics.tilesets.terrain, |
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 len = app.players.data.length; | |
for (var k = 0; k < len; k++) { | |
var player = app.players.data[k]; | |
if (player.x == mapX && player.y == mapY) { | |
var index = app.graphics.getAvatarFrame(player.direction, app.graphics.globalAnimationFrame); | |
var player_name = player.name || '???'; | |
var picture_id = player.picture; | |
if (isNaN(picture_id)) { | |
picture_id = 0; |
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 render(redrawNametags) { | |
// immediately draw canvas as black | |
app.graphics.handle.fillStyle = "rgb(0,0,0)"; | |
app.graphics.handle.fillRect(0, 0, app.graphics.viewport.WIDTH_PIXEL, app.graphics.viewport.HEIGHT_PIXEL); | |
var i, j; | |
var mapX = 0; | |
var mapY = 0; | |
var tile; | |
if (redrawNametags) app.graphics.nametags.hide(); |
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
<?php | |
session_start(); | |
?> | |
<html> | |
<head> | |
<title><?php echo $_SERVER['SERVER_NAME']; ?></title> | |
<style> | |
body { | |
background-color: #000; | |
margin: 10px; padding: 0px; |
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
<?php | |
/* | |
SofaDB, a pure PHP CouchDB alternative | |
Developed by Thomas Hunter | |
Released under the LGPL | |
May 1st, 2010 | |
Version 0.0.1 | |
This was something I started as a joke, basically a document storage system which | |
stores files on disk in the form of ID.json. It was never heavily tested... | |
*/ |
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
<?php | |
ini_set("error_reporting", E_ALL & ~E_NOTICE); | |
?> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<title>Genetic Algorithm : TSP : PHP Implementation by Thomas Hunter</title> | |
<style> | |
body { |
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
<?php | |
include("mysql.ssi.php"); | |
#Naming conventions: http://support.eve-online.com/Pages/KB/Article.aspx?id=37 | |
#Sample page format: http://www.example.com/?a=kill_detail&kll_id=1000000 | |
# This is a script I wrote a few years ago to scrape Eve Online kill mails. I ran it on a single | |
# core 2.4 Ghz with 2GB of RAM for a week and it scraped a couple million kills. It stores data | |
# in a relational format, but I've since lost the schema file. It can be easily reverse | |
# engineered from this file though. It would scrape sequentially, it should have run multiple | |
# requests in parallel for better efficiency. |
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
# Yes, openssl-devel is installed. | |
$ npm install bcrypt | |
npm http GET https://registry.npmjs.org/bcrypt | |
npm http 304 https://registry.npmjs.org/bcrypt | |
npm http GET https://registry.npmjs.org/bindings/1.0.0 | |
npm http 304 https://registry.npmjs.org/bindings/1.0.0 | |
> [email protected] install /home/thunter/unified-api/node_modules/bcrypt | |
> node-gyp rebuild |
OlderNewer