Skip to content

Instantly share code, notes, and snippets.

View adrianseeley's full-sized avatar

Adrian Seeley adrianseeley

View GitHub Profile
@adrianseeley
adrianseeley / clean_lines.cs
Created February 9, 2013 14:19
Removes horizontal and vertical lines from tilesets (in.png -> out.png)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
using System.IO;
namespace fixs
{
@adrianseeley
adrianseeley / lit_sickles.js
Last active December 13, 2015 23:29
Light Cycles in NodeJS! Plus Naive Neural Network (:
var GAME_WIDTH = 10;
var GAME_HEIGHT = 10;
var EMPTY = ' ';
var FULL = 'O';
function cls() { process.stdout.write('\u001B[2J\u001B[0;0f'); }
<html>
<script src="http://canvasquery.com/canvasquery.js"></script>
<script src="http://canvasquery.com/canvasquery.framework.js"></script>
<body>
<img id="car0" src="car0.png" style="display:none;"></img>
<script>
var rescar = document.getElementById('car0');
var car = {x: 0, y: 0, max_speed: 5, x_speed: 0, y_speed: 0, accel: 0.3, rotation: 0, rotation_speed: 0.05, uid: 0, lid: 0, rid: 0, did: 0};
var screen = cq(640, 480).framework({
@adrianseeley
adrianseeley / settings.xml
Created June 16, 2013 14:00
Not Bad Eclipse Formatting Eclipse > Preference > Java > Code Style > Formatter > Import (thisfile.xml) Press Cmd + Shift + F to invoke the formatter on your code.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="12">
<profile kind="CodeFormatterProfile" name="Adrian Thinks Eclipses Default Is Shit" version="12">
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
@adrianseeley
adrianseeley / this way.js
Last active December 18, 2015 19:09
how do i connect to that crazy socket load balancer?
var udid = 'TESTUDID' + Math.random();
function establish_connection (url) {
var socket = io.connect(url || 'http://localhost');
socket.on('connect', function() {
socket.emit('authenticate', {udid: udid, was_transferred_already: url ? 1 : 0}, function (res) {
if (res.hasOwnProperty('transfer')) {
console.log('transfering to: ' + res.transfer);
socket.disconnect();
return establish_connection(res.transfer);
} else {
@adrianseeley
adrianseeley / GPU.html
Last active December 19, 2015 00:28
GPU encoding floats on gpu, and reading those floats works, textures dont seem to be binding though...
<html>
<head>
<title>GPU</title>
<script>
function log (msg) { if (window.console && window.console.log) { console.log(msg); } }
function handleContextLost (e) { log("handle context lost"); e.preventDefault(); }
function handleContextRestored () { log("handle context restored"); init(); }
function checkGLError () { var error = GPU_Static.gl_context.getError(); if (error != GPU_Static.gl_context.NO_ERROR && error != GPU_Static.gl_context.CONTEXT_LOST_WEBGL) { var str = "GL Error: " + error; document.body.appendChild(document.createTextNode(str)); throw str; } }
WebGLUtils = function () {
@adrianseeley
adrianseeley / poker.js
Last active April 1, 2017 23:05
Texas Hold'em JS
var pack_of_cards = ['AS', '2S', '3S', '4S', '5S', '6S', '7S', '8S', '9S', 'TS', 'JS', 'QS', 'KS', 'AC', '2C', '3C', '4C', '5C', '6C', '7C', '8C', '9C', 'TC', 'JC', 'QC', 'KC', 'AD', '2D', '3D', '4D', '5D', '6D', '7D', '8D', '9D', 'TD', 'JD', 'QD', 'KD', 'AH', '2H', '3H', '4H', '5H', '6H', '7H', '8H', '9H', 'TH', 'JH', 'QH', 'KH'];
var hash_of_cards = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
var little_blind = 1;
var big_blind = 2;
var player_pool =
[
{id: 'aether', fn: 'aether'},
{id: 'Random Benchmark A', fn: 'random'},
{id: 'Random Benchmark B', fn: 'random'},
{id: 'Random Benchmark C', fn: 'random'},
{
"Bulbasaur": {
"hp": "45",
"atk": "49",
"def": "49",
"spatk": "65",
"spdef": "65",
"spd": "45",
"total": "318",
"average": "53"
@adrianseeley
adrianseeley / hmm.js
Last active December 29, 2015 04:49
hmm.js
var test =
[
['label0', 100, 200, 300, 400, 500],
['label0', 200, 100, 400, 300, 500],
['label1', 100, 100, 100, 100, 100],
['label1', 100, 100, 100, 100, 100],
['label2', 0, 0, 0, 0, 0],
['label2', 0, 1, 1, 0, 0],
];
@adrianseeley
adrianseeley / Naught.htm
Last active December 30, 2015 19:19
Naught
<!DOCTYPE html>
<html>
<head>
<title>Naught</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>