Skip to content

Instantly share code, notes, and snippets.

@AndrewYatzkan
AndrewYatzkan / ocp.js
Last active September 20, 2019 03:04
OnCampus+
//9768
var ran = false;
var showGPA = true;
var gaugeColor = '#0081c9';
var inSettings;
var currentHTML;
var col;
var gpaInt;
var sinceLastChecked;
var changes = [];
@AndrewYatzkan
AndrewYatzkan / averageRating.js
Last active June 22, 2019 02:45
Find the average rating on a scale of 1-N given an array of numbers.
function averageRating(arr) {
return arr.reduce((a,c,i)=>a+c*(i+1))/arr.reduce((a,c)=>a+c);
}
// example: averageRating([12, 234, 456, 767, 566]) => 3.8...
@AndrewYatzkan
AndrewYatzkan / scatter.js
Last active September 9, 2018 16:33
Quizlet Scatter Cheat (0.0 seconds)
/*
* Author : https://github.com/Andrew-9
* Description : Quizlet Scatter Cheat, works in 0.0 seconds.
************************************************************************
* Note: This only works in microscatter before you have start the game
************************************************************************
*/
// Click the start button
document.getElementsByClassName("UIButton--hero")[0].click();
@AndrewYatzkan
AndrewYatzkan / swipe.js
Created July 25, 2018 22:03
Simple and short swipe direction detection in vanilla js
var last={x: null,y: null};
document.addEventListener("touchstart", e => {
let touch = e.touches[0];
last.x = touch.clientX;
last.y = touch.clientY;
});
document.addEventListener("touchend", e => {
let touch = e.changedTouches[0];
let diff = {x:last.x-touch.clientX,y:last.y-touch.clientY};
if (Math.abs(diff.x) > Math.abs(diff.y)) {
@AndrewYatzkan
AndrewYatzkan / caesar-cipher.js
Last active June 11, 2018 21:48
Caesar Cipher / Character Shifter
// Shifts an alphabetic string (e.i. 'a' --> 'b')
// The 'str' argument is the string to pass in
// 'n' is the number of characters that should be shifted
// Supports shifting either forwards or backwards any amount
// Example:
// Input: shift('Ebiil, Tloia!', 3);
// Expected Output: "Hello, World!"
// Takes into account capital letters, lowercase letters, ignores non-alphabetic characters
function shift(str, n) {