Skip to content

Instantly share code, notes, and snippets.

View adrianseeley's full-sized avatar

Adrian Seeley adrianseeley

View GitHub Profile
@adrianseeley
adrianseeley / Crowd Complete - nodeJS
Created November 18, 2012 15:19
Crowd Complete :: a NodeJS Snippit for Ranked Crowd Sourced Auto Complete (Auto Complete Artificial Neural Network)
/* Crowd Complete :: a NodeJS Snippit for Ranked Crowd Sourced Auto Complete (Auto Complete Artificial Neural Network)
Usage:
Requires a running mongo database (db_url)
No solutions exist until you build them over time by 'feeding' the database with /fb.
/ac?e=getAutocompleteSolutionsFromAcDatabase
/fb?e=thisTextIsACompleteUserEntryThatIsBeingFedBackToTheAcDatabase
What is this?
TL;DR - Google's magic autocomplete bar.
@adrianseeley
adrianseeley / lettheghostsin.js
Created November 24, 2012 02:55
Let The Ghosts In (www.lettheghostsin.com) :: a NodeJS Snippit Containing The Current LTGI Source
var fs = require("fs");
var db_url = 'lettheghostsin';
var db = require('mongojs').connect(db_url, ['wisdom']);
var http = require('http');
var url = require('url');
var html_header = '<!doctype html><html><head><meta charset="UTF-8"><title>Let the Ghosts in</title><link href="http://fonts.googleapis.com/css?family=Abel" rel="stylesheet" type="text/css"><style rel="stylesheet" type="text/css">html {margin: 0; padding: 0 10%;}body {font-family: "Abel", Helvetica, sans-serif; font-size: 18px; text-align: center; background-color: #0B0B0B; color: #FFF;}header {margin-top: 5em;}form { border-bottom: 1px solid #999; padding-bottom: 2em;}input { width: 80%; margin: 3em auto 1em; font-size: 1.2em; padding: 0.5em; display: block; }button {width: 40%; padding: 0.5em; background-color: #575757; border: none; color: #fff; font-size: 1.2em; cursor: pointer; }button:hover { background-color: #969696;}.result { width: 63%; margin: 1em auto; padding: 0.5em 40px; border: 2px solid #262626; border-rad
@adrianseeley
adrianseeley / valhalla_compiler.cs
Created November 24, 2012 14:43
Valhalla :: a Snippet Bundle Containing The Current Valhalla Source
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using System.IO;
using System.Reflection;
using System.CodeDom;
using System.CodeDom.Compiler;
@adrianseeley
adrianseeley / HTML5Jumper.html
Created November 30, 2012 20:12
HTML5 Canvas Dynamic Content + Follow Mouse
<html>
<div align = 'center'>
<canvas
id = 'c'
width = '800'
height = '600'
style = 'border:1px solid #000000;'>
</canvas>
<script>
@adrianseeley
adrianseeley / ygg.cs
Created December 1, 2012 11:48
Ygg- OCR Solver :: a C# Snippet for Cloud Building a Fixed Function Optical Character Recognition Solver
// ygg - OCR solver (swarm friendly, requires mongodb c# driver, and mongod running at the IP specified)
// ~(3/96)% wrong at 30k genes in roughly 24 single core (2.2ghz) compute hours
// adrian@gatosomina.com
// using a cluster at head methodology to control the swarm, read 100 - gen 100 - sync all
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
@adrianseeley
adrianseeley / Ease.cs
Created December 9, 2012 00:17
C# Ease Library :: a C# Snippet for Easing
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace YOUR_NAMESPACE_HERE_BRO
{
static class Ease
{
public static float LINEAR(float CurrentStep, float TotalSteps, float StartValue, float ValueChange)
@adrianseeley
adrianseeley / SoundPool.cs
Created December 10, 2012 12:08
SoundPool :: a C# XNA 4.0 Snippet for Properly Instancing Sound Effects Using an As-Needed Pool Methodology
// Create a pool:
// SoundPool explosion = new SoundPool(Content, "explosion"); - uses explosion.wav from the content folder
// Play back the sound:
// explosion.Play();
// Play back the sound with some funk:
// explosion.Play(Volume: 1.0f, Pan: 0.0f, Pitch 0.0f);
//
// If you're worried about performance, I promise this is the fastest and cleanest way.
// You may run into issues if you try to spam too many sounds on the wrong devices, from MSOFT:
//
@adrianseeley
adrianseeley / gist:4416816
Last active December 10, 2015 09:49
TSP GAopt - in progress...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Threading;
using System.Drawing;
namespace tsp
@adrianseeley
adrianseeley / test.js
Last active December 11, 2015 11:08
Easiest Ever NodeJS Testing
/* Output:
node test.js
Testing: always_pass...passed
Testing: always_fail...failed
Testing: include_meaningful_results...failed
3 Tests Completed! Passed: 1 Failed: 2
Failed Test Output:
{"test":"always_fail","passed":false}
{"test":"include_meaningful_results","passed":false,"meaningful_data":"This results object will display as a JSON string if this test fails"}
*/
@adrianseeley
adrianseeley / ngram_plus_ngram_mash.js
Created January 31, 2013 14:48
JS ngram + ngram mash
function ngram(string)
{
string = string.toString().toLowerCase();
var valid = 'abcdefghijklmnopqrstuvwxyz '; for(var s = 0; s < string.length; s++) if(valid.indexOf(string[s]) == -1) { string = string.slice(0, s) + string.slice(s + 1); s--; }
string = string.split(' ');
var ngrams = [];
var to_gram = ngram_mash(string);
to_gram.push(string);
for(var g = 0; g < to_gram.length; g++)
{