Skip to content

Instantly share code, notes, and snippets.

View highwaycoder's full-sized avatar

Highwaycoder highwaycoder

  • England
  • 09:29 (UTC)
View GitHub Profile
@highwaycoder
highwaycoder / delete-my-discord-messages.js
Last active August 17, 2018 21:45
Batch delete for your own messages on a discord server. Use with caution. Work in progress.
var before = 'LAST_MESSAGE_ID';
var authorId = 'AUTHOR_ID';
const authToken = 'AUTH_TOKEN';
let clearMessages = () => {
const channel = window.location.href.split('/').pop();
const baseUrl = `https://discordapp.com/api/channels/${channel}/messages`;
const headers = {
"Authorization": authToken
};
@highwaycoder
highwaycoder / update-dns.js
Created December 28, 2014 15:56
Update a DNS record using the Digital Ocean REST API. Configure using the constants at the top, run using "node update-dns". NB: borrows heavily from the PHP version from @bensquire called Digital-Ocean-Dynamic-DNS-Updater
const ACCESS_TOKEN = '';
const DOMAIN = '';
const RECORD = '';
var http = require('http');
var https = require('https');
var when = require('when');
var color = require('bash-color');
var fetchExternalIp = function () {
class Foo
privateBar = "bar"
constructor: () ->
getPrivateBar = _.bind getPrivateBar, @
getPrivateBar = () ->
privateBar
@highwaycoder
highwaycoder / SPEC.md
Last active December 30, 2015 18:59
Specification for Mojo, the Javascript MMO I'm currently designing. WIP.

Version 1.0

Mojo version 1.0 is a full-fledged MMORPG system including content, characters, a combat system, reward items and quests.

Client

  • Registration
    • Register a new user account
    • Modify an existing user account
    • Delete a user account
  • Billing
@highwaycoder
highwaycoder / layout.jison
Last active December 30, 2015 01:09
Grammar for my proposal for a DSL for laying out websites written in HTML/CSS. I'm just looking for feedback on the grammar, not on the proposal itself (I'm sure there are lots who think it's a stupid idea) nor the beginnings of the implementation.
%{
require("Layout");
// just ignore this line, it's related to my plans to implement the language, but I just want feedback on the grammar right now.
var layout = new Layout();
%}
%lex
%%
\s+ /* Skip whitespace */
@highwaycoder
highwaycoder / SevenSegmentDisplay.js
Created November 28, 2013 21:17
Pretty basic 7-segment display module for a node.js project I'm working on in secret. Couldn't resist sharing this though, I really like it! Expects a canvas of bare minimum size 144x60, ideally 150x66 to give it symmetrical padding. Oh, and it doesn't unencode BCD yet, because that's not yet important. If you feed it a raw value, it should disp…
/*
My 7-seg is a bit weird, sorry, here's how it works:
/ --- 0 --- \
| |
| |
1 5
| |
| |
> --- 6 --- <
| |
@highwaycoder
highwaycoder / game.js
Created July 12, 2013 12:34
Why I'm not a front-end developer.
var intervalID = -1,
frameNumber = 0;
var QueueNewFrame = function () {
frameNumber++;
if(frameNumber > 60) frameNumber = 0;
if (window.requestAnimationFrame)
window.requestAnimationFrame(renderLoop);
else if (window.msRequestAnimationFrame)
window.msRequestAnimationFrame(renderLoop);
else if (window.webkitRequestAnimationFrame)
@highwaycoder
highwaycoder / playerqueue.js
Created July 9, 2013 01:14
A queue implementation in JavaScript that doesn't suck. Note that the search-based retrieval algorithm is O(n) but 'dequeue' is O(1) so the overall search speed is O(n) where it would've been O(n**2) if I used Array.shift() to perform the 'dequeue' step. Feedback welcome.
var QueueElement = function(playerInfo) {
this.name = playerInfo.name;
this.rank = playerInfo.rank;
this.last_seen = playerInfo.last_seen;
this.next = undefined;
this.prev = undefined;
}
var head = undefined,
queue_size = 0;
#include <iostream>
#include <fstream>
#include <cstring>
#include <vector>
#include <string>
using namespace std;
int main(int argc, char* argv[]) {
if (argc != 2) {
@highwaycoder
highwaycoder / apps.json
Last active December 14, 2015 09:19
Simple, http-based node.js proxy server, connects clients to node.js applications based on the domain name used in the request. Not currently working.
{"apps" :
[
{
"name": "fieldlord",
"domains": ["fieldlord.chaos-kitten.com","fieldlord"],
"port": "1337"
}
]
}