Skip to content

Instantly share code, notes, and snippets.

View evantahler's full-sized avatar
💭
Programmin'

Evan Tahler evantahler

💭
Programmin'
View GitHub Profile
@evantahler
evantahler / game-actions.js
Created July 1, 2013 05:05
Creating the API for a tic-tac-toe game with AI
// actions/game.js
// A collection of tasks and helper methods to create a simpel tic-tac-toe game
// - single player
// - simple AI
// - each connection can only have one active game at a time
exports.gameCreate = {
name: "gameCreate",
description: "I create a new game for this connection",
@evantahler
evantahler / fayeApp.js
Created October 22, 2013 05:47
Faye + Faye Redis connection going down with a `callback(null)` extension
var faye = require('faye');
var fayeRedis = require('faye-redis');
var http = require('http');
var fs = require('fs');
var channel = "/chat"
var options = {
mount: "/faye",
timeout: 45,
ping: null,
@evantahler
evantahler / config.js
Last active August 29, 2015 13:57
an action to send files
// ...
config.servers.web.rootEndpointType = 'api'
// ...
@evantahler
evantahler / dmx.js
Last active July 26, 2018 19:59
enttec open dmx + nodejs
#!/usr/bin/env node
// A simple DMX example which will turn all the lights on and off every second
// You can use this as a fork within another application as well (cluster-awareness)
////////////
// dmx.js //
////////////
var ftdi = require('ftdi');
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
</head>
<body>
<div id="container"></div>
<script type="text/javascript">
var doRequest = function(action){
$.get('/api/' + action, function(data){
@evantahler
evantahler / webSocketLoadTest.html
Created June 16, 2014 05:42
A websocket load test for actionhero
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="content-language" content="en" />
<meta name="description" content="actionhero.js" />
<title>actionhero.js WebSocket Load Test</title>
<style>
.green {background-color: green;}
.red {background-color: red;}
### Keybase proof
I hereby claim:
* I am evantahler on github.
* I am evantahler (https://keybase.io/evantahler) on keybase.
* I have a public key whose fingerprint is 8132 187A 483C CB1C D6D4 A5DF ED85 B288 15AC F3BE
To claim this, I am signing this object:
@evantahler
evantahler / gist:2417bfed451886e9fb61
Created January 4, 2015 20:27
Actionhero + XMPP boilerplate
var XmppPrototype = require('node-xmpp');
var xmpp = function(api, options, next){
//////////
// INIT //
//////////
var type = 'xmpp'
var attributes = {
@evantahler
evantahler / aaa.bash
Last active August 29, 2015 14:13
Can't log into NPM
> uname -a (osx yosemite)
Darwin Opsimus.local 14.0.0 Darwin Kernel Version 14.0.0: Fri Sep 19 00:26:44 PDT 2014; root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64
> node --version
v0.10.35
> npm --version
2.1.18
> npm login
@evantahler
evantahler / production.rb
Last active August 29, 2015 14:14
If you want ansible tower to source an inventory file checked into a project, here's an example of how to do it.
#!/usr/bin/env ruby
require 'json'
inventory_file = 'production'
# Configure inputs
# assumes a project layout with ./inventories/{{ inventory_file }}
if File.exists? '/var/lib/awx/projects/'
folder = Dir.glob('/var/lib/awx/projects/*').max { |a,b| File.ctime(a) <=> File.ctime(b) }