Skip to content

Instantly share code, notes, and snippets.

@ereidland
ereidland / RandomNameGenerator.html
Created June 13, 2021 20:37
Completely random name generator with simple rules: At least 1 vowel for each consonant. Consonants must be separated by a vowel. Y can be a consonant or vowel.
<html>
<title>RANDOM name generator</title>
<body onLoad="OnLoad()">
<button id="generate" onClick="GenerateClicked()">Generate</button>
<table id="names">
</table>
<script>
var table = {};
var vowels = "aeiouy";
@ereidland
ereidland / stat_test.js
Created June 23, 2015 01:20
Rough testing of average stat roll for DnD
function Roll(sides)
{
return 1 + Math.round(Math.random()*(sides - 1));
}
function RollForStat()
{
var totals = [Roll(6), Roll(6), Roll(6), Roll(6)];
var lowestIndex = 0;
var lowestNumber = totals[0];
@ereidland
ereidland / StaticCoroutine.cs
Created December 11, 2013 20:08
Static Coroutine in Unity
using UnityEngine;
using System.Collections;
public class StaticCoroutine : MonoBehaviour
{
private static StaticCoroutine _instance;
public static void Do(IEnumerator enumerator)
{
if (_instance == null)
@ereidland
ereidland / VRSkybox.cs
Created October 2, 2013 16:23
VR Skybox by Nora (stereoarts.jp) with minor change to add color tint.
// coded by Nora
// http://stereoarts.jp
using UnityEngine;
using System.Collections.Generic;
public class VRSkybox : MonoBehaviour
{
public enum Shape
{
Sphere,
@ereidland
ereidland / Program 12(C++ I Lab).cpp
Last active December 16, 2015 10:08
Dynamic memory allocation, name sorting, and searching.
#include <stdio.h>
#include <iostream>
using namespace std;
#define LONG_NAME_SIZE 512
void main()
{
int numNames = 0;
@ereidland
ereidland / Example 7 (Question 12).cpp
Created April 13, 2013 17:17
Example 7 at Library
//Question 12 answer
//Given this struct:
struct student
{
string name;
int credits;
double grades[6];
};
student * highestGrade(student students[], int numberOfStudents)
@ereidland
ereidland / Example 6 at Library.cpp
Created April 13, 2013 16:57
Example 6 at Library.
#include <iostream>
using namespace std;
char * myFunction(const char * str)
{
//Declare the fixed size array of 32 ize.
char fixedSizeArray[32];
//Copy str into it.
strcpy(fixedSizeArray, str);
@ereidland
ereidland / C++ ref (at library).cpp
Created April 13, 2013 16:37
Reference at Library.
//Format for functions:
//type name (arguments)
//{}
char * myFunction (int lol)
{
//Variables:
//type name;
char * myArray;
//Initializing to new array:
@ereidland
ereidland / alljs.php
Last active December 16, 2015 04:29
Loads all JavaScript files in a directory, and echos back their contents. Needs some work, but it works for a quick hack during development when dealing with lots of javascript files.
<?php
//To echo everything alphabetically:
// includeJS("./");
//includeJS can take an entry set or a path.
//For getting an entry set:
// getJSEntries($path [, $baseentries = []])
//$baseentries can be specified so that all file entries within $baseentries will be ignored.
//If $path is a file, it adds that file to the existing entries (specified by $baseentries).
//If $path is a folder, it does the same as the above for each file. Note that folder searches are recursive.
//The return result is the $baseentries array, merged with the sorted results of getJSEntries.
@ereidland
ereidland / gist:5278241
Last active December 15, 2015 14:58
Example 5 at Library
#define MAX_INVENTORY 100
//Arguments to use in cin.ignore:
#define IGNORE_ARGS 256, '\n'
#include <fstream>
#include <iomanip>
#include <iostream>
#include <string>