Skip to content

Instantly share code, notes, and snippets.

View matthewd673's full-sized avatar

Matthew Daly matthewd673

View GitHub Profile
@matthewd673
matthewd673 / README.md
Last active February 24, 2023 05:39
Explore how Wikipedia articles connect to each other

wikiweb.rb

A very poor use of time.

Build & run

  • Download wikiweb.rb
  • Ruby 3.2.1 required (or something reasonably recent)
  • Requires nokogiri (gem install nokogiri)

Usage

@matthewd673
matthewd673 / rhyme.js
Last active November 20, 2021 03:35
Check if two words rhyme
//download dictionary from https://svn.code.sf.net/p/cmusphinx/code/trunk/cmudict/cmudict.0.7a
//dictionary format: ['RHYME', 'R AY1 M']
const rhymeDict = [];
//despite the size of the file, this parses reasonably quickly
function populateRhymeDict() {
fetch('cmudict.0.7a.txt')
.then(response => response.text())
.then(data => {
@matthewd673
matthewd673 / main.rs
Created December 22, 2020 18:03
ray_engine
//ray_engine rs
//requires sdl2 crate
extern crate sdl2;
use sdl2::pixels::Color;
use sdl2::event::Event;
use sdl2::keyboard::Keycode;
use sdl2::rect::Point;
use sdl2::rect::Rect;
@matthewd673
matthewd673 / detectCollision.cs
Created January 7, 2017 16:15
simple collision detection in c#
public static bool detectCollision(Rectangle rect1, Rectangle rect2)
{
if (rect1.X < (rect2.X + rect2.Width) &&
(rect1.X + rect1.Width) > rect2.X &&
rect1.Y < (rect2.Y + rect2.Height) &&
(rect1.Height + rect1.Y) > rect2.Y)
return true;
else
return false;
}
@matthewd673
matthewd673 / generator.java
Created July 17, 2015 16:08
A simple dungeon generator for MiniLD 61
public static int[][] rooms = new int[100][100];
public static void generate()
{
Random rndgen = new Random();
for(int i = 0; i <= 99; i++)
{
for(int j = 0; j <= 99; j++)
@matthewd673
matthewd673 / LoadSprites.java
Created May 16, 2015 17:44
A simple class to load images from URLs (used for MiniLD #59)
package com.bitbit.minild59.codes.main;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.URL;
import javax.imageio.ImageIO;
public class LoadSprites
{
@matthewd673
matthewd673 / index.html
Created April 11, 2015 14:34
A little thing I made this morning, could be handy for collaborative coding services. Uses codemirror.net
<!DOCTYPE html>
<html>
<head>
<title>codewread</title>
<script src="codemirror-4.10/lib/codemirror.js"></script>
<link rel="stylesheet" href="codemirror-4.10/lib/codemirror.css">
<script src="codemirror-4.10/mode/javascript/javascript.js"></script>
<style>
#comment
{
@matthewd673
matthewd673 / sprite.cs
Created April 10, 2015 16:15
I'm writing a little game engine in C#, this is the sprite class in it's early stages
//Maybe use Bitmap
private static Image[] frameArray;
public static Image active_frame;
public static int active_frame_number;
public sprite(Image[] frame_array)
{
frameArray = frame_array;
active_frame_number = 0
active_frame = frameArray[active_frame_number];
@matthewd673
matthewd673 / Vowels.cs
Last active August 29, 2015 14:15
Farhanalee asked for help on DaniWeb. Here you go, Farhanalee
//Assumed this was a console app
readAString()
{
Console.WriteLine("Type in a word and BE AMAZED!");
string input = Console.ReadLine;
Console.WriteLine(Convert.ToString(countVowels(input)) + " vowels. Now you know!");
Console.ReadKey();
//Not sure how isVowel fits in here but you get the idea
}
@matthewd673
matthewd673 / timecheck.js
Created October 12, 2014 19:50
Time check (JS)
var d = new Date();
d.getHours();
d.getMinutes();
d.getSeconds();
d.getDay();