Skip to content

Instantly share code, notes, and snippets.

View Ratstail91's full-sized avatar
💭
Back in my day, we didn't need no AI.

Kayne Ruse Ratstail91

💭
Back in my day, we didn't need no AI.
View GitHub Profile
//environment variables
require('dotenv').config();
//libraries
let mysql = require('mysql');
//utilities
let { log } = require('./logging.js');
let connection;
@Ratstail91
Ratstail91 / main.js
Last active July 4, 2019 12:03
A simple clicker game example written for a friend.
//constants
var SAVE_NAME = 'cookieCount.foodfare';
//the gameplay variables
var cookies = 0;
var cursors = 0;
var upgrades = 0;
//the display variables
var cookieNode = document.getElementById('cookies');
@Ratstail91
Ratstail91 / validate_token_credentials.js
Created June 24, 2019 14:15
Literally all of my functions look like this!
const validateTokenCredentials = (connection) => (fields) => new Promise( (resolve, reject) => {
const validateQuery = 'SELECT COUNT(*) AS total FROM sessions WHERE sessions.accountId = ? AND sessions.token = ?;';
return connection.query(validateQuery, [fields.id, fields.token])
.then(results => results[0].total > 0 ? resolve(fields) : reject({msg: 'Invalid password change credentials', extra: [fields.id, fields.token]}))
;
});
#comments begin with a pound sign
#The script automatically calls the function "main" after loading it
#this is how you declare a function called "main"
START main:
#do stuff
END #all functions finish with END
#this is how you write a function with arguments
const { roleLength } = require('utils');
const ROLE_NAME = 'scout';
function spawn(origin, max, roleName, type = 'small') {
if (roleLength(Game.creeps, roleName, origin) >= max) {
return;
}
//determine the size to use
@Ratstail91
Ratstail91 / CameraController.cs
Created August 3, 2019 14:39
My attempt at camera shake - didn't work.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraController : MonoBehaviour {
[SerializeField]
GameObject target;
[SerializeField]
float lerpSpeed = 2f;
@Ratstail91
Ratstail91 / recursion.toy
Created August 14, 2019 18:46
My interpreter is currently a bit... inconsistent.
/* stack overflow, as expected
var counter = 0;
const recursion = () => {
print ++counter;
recursion();
};
recursion();
*/
//good for preventing duplicated code
[System.Serializable]
struct AudioData {
public string name;
public AudioSource source;
//other data, such as modulation
}
public List<AudioData> audioList = new audioList<AudioData>();
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnemyController : MonoBehaviour {
//structures
enum Direction {
UP, LEFT, RIGHT, DOWN,
};

Card types:

  • Base Summon Card (1 cost, empty summon, 1 HP by default)

  • Base Weapon Card (1 cost, empty weapon, 1 ATK by default)

  • Base Spell Card (1 cost, empty spell, does nothing)

  • Summon Modifier Card (applies new text to a summon)

  • Weapon Modifier Card (applies new text to a weapon)

  • Spell Modifier Card (apploes new text to a spell)