Skip to content

Instantly share code, notes, and snippets.

View aarongeorge's full-sized avatar
🤖

ADG aarongeorge

🤖
View GitHub Profile
@aarongeorge
aarongeorge / .eslintrc.js
Created April 17, 2019 12:53
My eslint configuration file
module.exports = {
'env': {
'browser': true,
'es6': true,
'node': true
},
'parserOptions': {
'allowImportExportEverywhere': false,
'babelOptions': {
'configFile': './babel.config.js'
--- Input ---
Game: CS
DPI: 400
Resolution: 3440x1440
Sensitivity: 4
360 Distance: 10.2273 inches
--- Calculated ---
{
"rules": {
"at-rule-blacklist": [],
"at-rule-empty-line-before": [
"always",
{
"except": [
"after-same-name",
"first-nested"
],
@aarongeorge
aarongeorge / primeNumbers.js
Last active April 30, 2020 11:24
Interview question to find all prime numbers between 0 and 100
// The definition of a prime number is a positive integer that has exactly two positive divisors (This means the divisors could only ever be 1 and the number itself)
// Given that's the case, 0 can't be a prime as you can't divide 0 by 0. Just as 1 can't be prime as 1 divided by 1 is using the same divisor.
// This means any time we want to loop to find a prime, we can ignore 0 and 1 and start at 2
// So given the definition of a prime we can write a function like this to check if a number is prime
const isPrime = n => {
for (let i = 2; i < n; i++)
if (!(n % i)) return !!0
return n > 1
}
@aarongeorge
aarongeorge / invisible-code-generator.js
Last active April 6, 2020 00:54
A code generator that takes Javascript and compiles it to ASCII Control Characters that are not visible, based on Martin Kleppe's "Invisible Code" talk
/**
* Invisible Code Generator
*
* Description:
* A code generator that takes Javascript and compiles it to
* ASCII Control Characters that are not visible
*
* Usage:
* Copy and paste the code into your browsers console
* Then paste the code you wish to convert to "Invisible Code"
@aarongeorge
aarongeorge / get-codecs.js
Last active December 2, 2017 12:04
Get supported audio and video codecs of the browser
/**
* Get Codecs
*
* Usage:
*
* getCodecs() Returns an object with the keys 'audio' and 'video'
* each contain an array of the supported codecs for the browser
*
* Author: Aaron George
* Github: github.com/aarongeorge
@aarongeorge
aarongeorge / easings.ts
Last active October 5, 2020 07:35
A list of easing functions for use with JavaScript and TypeScript
/**
* A list of easing functions for use with JavaScript and TypeScript
*
* Usage:
*
* `Easings.linear(t)`
* Where `t` in a value between 0 and 1
*/
@aarongeorge
aarongeorge / Draggie.ts
Last active June 24, 2020 00:26
A library for dragging DOM elements around
/**
* Draggie.ts
*
* A library for dragging elements around
*
* Github: https://gist.github.com/aarongeorge/2e1c970a4d0032e98fa2eb51bb40e00b
* Demo: https://codepen.io/AaronGeorge/full/oGZoBg/
*/
interface Constraints {
First install: Package Control from https://packagecontrol.io/installation
Once that has installed, use Package Control to install the following:
A File Icon (Adds file type icons)
Babel (Adds support for ES6 syntax)
Bracket Highlighter (Adds various styles of bracket highlighting to Sublime)
CSS Extended Completions (Adds additional CSS completions)
Emmet (Adds various shorthand to write code faster)
JSX (Adds JSX Syntax)
Material Theme (Adds the nice Material Theme)
@aarongeorge
aarongeorge / createAudioContext.js
Last active April 6, 2020 01:43
A function that will create an audio context that bypasses the iOS sample rate mismatch bug
/**
* A function that will create an audio context that fixes
* the iOS sample rate mismatch bug
*
* Author: Aaron George https://github.com/aarongeorge
*/
// Create Audio Context
const createAudioContext = (desiredSampleRate = 44100) => {