Skip to content

Instantly share code, notes, and snippets.

style
* {
box-sizing: border-box;
}
body {
margin: 0 0;
padding: 0;
background-color: #eee;
text-align: center;
}
player = false
inGame = false
me = undefined
dead = undefined
gameID = window.location.hash.slice 1
socket = io.connect 'http://localhost'
# PLAYER EVENTS
kill = (target) ->
if inGame and player and not dead then socket.emit 'kill', target
app = require('http').createServer(handler)
io = require('socket.io').listen(app)
fs = require('fs')
app.listen 80
handler = () ->
fs.readFile __dirname + '/index.html', (err, data) ->
if err
res.writeHead 500
# required in process.env: host, cloudant_account, cloudant_key, cloudant_pass,
# cloudant_db_accounts, cloudant_db_data, cookie_secret, redis_url, redis_port, redis_path,
# smtp_email, smtp_pass, smtp_host, smtp_ssl
bodyParser = require 'body-parser'
cloudant = require 'cloudant' account: process.env.cloudant_account,
key: process.env.cloudant_key,
password: process.env.cloudant_pass
email = require 'email'
express = require 'express' ()
# DATA
## USER
email KEY string
name string
elevated boolean
auth string -> USER.email
key string
expires date
@jda0
jda0 / server.coffee
Last active April 19, 2018 19:24
flyt.server
###
REDIS SCHEMA
------------
SET @domain.al@email key
STRING @domain.ae@email token
HASH @domain.as@key A acl, S secret
HASH @domain.u@email N name, A acl, [T trustee], [X delete]
module cpu;
reg [7:0] ax, bx, ix, pc;
reg [3:0] ir;
reg [7:0] mem [0:255];
// reset
initial begin
ax <= 0;
bx <= 0;
@jda0
jda0 / Mastermind.js
Created January 23, 2017 00:15
Easy version of the board game mastermind
class Mastermind {
constructor() {
this.length = 4
this.chars = ['0', '1', '2', '3', '4', '5']
}
generate() {
this.key = []
for (var i = 0; i < this.length; i++)
this.key.push(this.chars[(Math.random() * this.chars.length) | 0])
@jda0
jda0 / app.js
Created May 28, 2017 21:37
AWS Score Bot
// process.env: {...keys, FB_PAGE_ACCESS_TOKEN, VERIFY_TOKEN}
// Requires DynamoDB
// Setup: Copy to clean directory, `npm install aws-sdk request`, zip & upload to Lambda.
'use strict'
const request = require('request')
const AWS = require('aws-sdk')
const docClient = new AWS.DynamoDB.DocumentClient()
@jda0
jda0 / .vimrc
Created September 9, 2017 06:25
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'vim-airline/vim-airline'
Plugin 'edkolev/promptline.vim'
Plugin 'sjl/gundo.vim'