Skip to content

Instantly share code, notes, and snippets.

View LyndonArmitage's full-sized avatar

Lyndon Armitage LyndonArmitage

View GitHub Profile
@LyndonArmitage
LyndonArmitage / greyscript.vim
Last active January 11, 2021 10:24
GreyScript Vim Syntax file
" Vim syntax file
" Language: GreyScript
" Maintainer: Lyndon Armitage
" Latest Revision: 03 September 2020
" To get working place in .vim/syntax
" Then you will want to make sure vim uses this file for .src files
" You could add the following to .vimrc
" au BufRead,BufNewFile *.src set filetype=greyscript
import scala.collection.mutable
// The word wheel data
val required = List[Char]('a')
val otherChars = List[Char]('t', 'n', 'd', 'o', 'e', 'c', 'i', 'u')
// Load a word list and remove anything smaller than 2 letters
val wordList = scala.io.Source.fromInputStream(getClass.getResourceAsStream("/wordsEn.txt"))
.getLines()
.filter(_.length > 2)
@LyndonArmitage
LyndonArmitage / anagram.sc
Last active January 25, 2016 23:12
anagram scala file
import java.io.File
import scala.collection.mutable
def sortWord(word: String) = new String(word.toCharArray.sorted)
val wordList = scala.io.Source.fromFile(
new File("wordsEn.txt"))
.getLines()
.filter(_.length > 2)
@LyndonArmitage
LyndonArmitage / Grid.java
Created July 30, 2014 18:16
Reddit DailyProgrammer Challenge 173: Langtons Ant
package com.lyndonarmitage.daily.langton;
import javax.imageio.ImageIO;
import javax.swing.*;
import javax.swing.filechooser.FileFilter;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
@LyndonArmitage
LyndonArmitage / glider.txt
Last active August 29, 2015 13:58
Basic Conways Game Of Life in C
#..
.##
##.
@LyndonArmitage
LyndonArmitage / cookiebot.js
Created September 11, 2013 19:34
CookieClicker Bot
/*
Cookie Clicker Bot by Lyndon Armitage.
Cookie Clicker itself is a game copyright of Orteil 2013.
You can play it here: http://orteil.dashnet.org/cookieclicker/
This is a very basic bot for Cookie Clicker.
It is written in such a way that it does not interact directly with the game itself but instead it relies on reading
the CSS/HTML IDs and classes of the GUI elements on the page.
@LyndonArmitage
LyndonArmitage / index.html
Created August 20, 2013 16:02
The Index.html for a jQuery based PDF Viewer that makes use of the PDF to HTML5 converter made by http://www.idrsolutions.com/
<!DOCTYPE html>
<html>
<head>
<title>jQuery Viewer Example</title>
<style type="text/css">
body {
background: #0000FF;
}
#container {
margin-left: auto;
@LyndonArmitage
LyndonArmitage / checkPDF.js
Created July 11, 2013 14:21
js/checkPDF.js
/**
* Used to attach events to an element or object in a browser independent way
* @param element
* @param event
* @param callbackFunction
*/
function attachEvent(element, event, callbackFunction) {
if(element.addEventListener) {
element.addEventListener(event, callbackFunction, false);
}
<!DOCTYPE html>
<html>
<head>
<title>Check if File is PDF on the Client Side</title>
</head>
<body>
<form id="uploadForm">
<label>Upload a PDF: <input type="file" id="fileUpload" name="file" /></label>
</form>
<script type="text/javascript" src="js/checkPDF.js"></script>
@LyndonArmitage
LyndonArmitage / analogCanvasClock.js
Last active May 24, 2023 19:21
The JavaScript file for the HTML5 Clock
/**
* Setup and start an analog clock using a canvas
* @param canvas The canvas to use
* @param clockWidth The width of the clock (radius*2)
* @author Lyndon Armitage
*/
function setupAnalogClock(canvas, clockWidth) {
var ctx = canvas.getContext("2d");
var centerX = canvas.width / 2;
var centerY = canvas.height / 2;