Skip to content

Instantly share code, notes, and snippets.

Kayne Ruse Ratstail91

Block or report user

Report or block Ratstail91

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View EnemyController.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnemyController : MonoBehaviour {
enum Direction {
View audiodata.cs
//good for preventing duplicated code
struct AudioData {
public string name;
public AudioSource source;
//other data, such as modulation
public List<AudioData> audioList = new audioList<AudioData>();
Ratstail91 / recursion.toy
Created Aug 14, 2019
My interpreter is currently a bit... inconsistent.
View recursion.toy
/* stack overflow, as expected
var counter = 0;
const recursion = () => {
print ++counter;
Ratstail91 / CameraController.cs
Created Aug 3, 2019
My attempt at camera shake - didn't work.
View CameraController.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraController : MonoBehaviour {
GameObject target;
float lerpSpeed = 2f;
View role.scout.js
const { roleLength } = require('utils');
const ROLE_NAME = 'scout';
function spawn(origin, max, roleName, type = 'small') {
if (roleLength(Game.creeps, roleName, origin) >= max) {
//determine the size to use
View example.newlang
#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
Ratstail91 / validate_token_credentials.js
Created Jun 24, 2019
Literally all of my functions look like this!
View validate_token_credentials.js
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.token])
.then(results => results[0].total > 0 ? resolve(fields) : reject({msg: 'Invalid password change credentials', extra: [, fields.token]}))
Ratstail91 / main.js
Last active Jul 4, 2019
A simple clicker game example written for a friend.
View main.js
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');
View database.js
//environment variables
let mysql = require('mysql');
let { log } = require('./logging.js');
let connection;
View hitstun_example.cs
//how to call the hitstun animation
StartCoroutine(TriggerHit(0.8f)); //0.8 seconds of invulnerability
IEnumerator TriggerHit(float delay) {
invulnerable = true; //allow for a window of time to get away
StartCoroutine(TriggerHitGraphic(0.1f, delay - 0.1f));
yield return new WaitForSeconds(delay);
invulnerable = false;
You can’t perform that action at this time.