This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const tuple = ["a", "b", "c", "d"] as const; | |
type Tuple = typeof tuple; | |
type FirstElement<Tuple extends readonly any[]> = Tuple[0]; | |
type ShiftOne<Tuple extends readonly any[]> = Tuple extends readonly [Tuple[0], ...infer U] ? U : never; | |
type PopOne<Tuple extends readonly any[]> = Tuple extends readonly [...infer U, Tuple[number]] ? U : never; | |
type LastElement<Tuple extends readonly any[]> = Tuple extends readonly [...Tuple[number], infer U] ? U : never; | |
type Indices<Tuple extends readonly any[], TStart extends number[]> = Tuple['length'] extends 0 ? PopOne<[0, ...TStart]> : Indices<ShiftOne<Tuple>, [Tuple['length'], ...TStart]>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A singleton which holds and updates mouse move / touch move pointer positions. | |
* Exporting or placing this in your code exposes Mouse. | |
*/ | |
export class Mouse { | |
private static instance = new Mouse(); | |
private position: [number, number] = [0, 0]; | |
private constructor() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To add a change to our repository | |
git checkout -b "feature/feature-name" # Creates a branch called "feature/feature-name", then checks it out, locally. | |
git push --set-upstream origin feature/feature-name # Publish the branch on GitHub | |
# Make changes to your files | |
git add FILENAME(S) # Adds your files to "Tracked". | |
git status # See your "Staged and Unstaged files (green and red respectively" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const countTokens = (tokenMatcher: RegExp, input: string) => | |
input | |
.match(tokenMatcher) | |
?.map((token: string) => | |
token.replace(/((\+|\-|^){1}$(?![0-9]))/g, match => (match === '-' ? '-1' : '1')), | |
) | |
.map(token => parseInt(token)) | |
.reduce((accumulator, currentValue) => accumulator + currentValue, 0) ?? 0; | |
const countVariables = (input: string) => countTokens(/((\+|\-|^)|(-*)[0-9]){1}(?=x)/g, input); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import json | |
import csv | |
from nltk.stem.lancaster import LancasterStemmer | |
stemmer = LancasterStemmer() | |
f = open('mscoco.json') | |
data = json.load(f) | |
f.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup() { | |
// initialize serial communications (for debugging only): | |
Serial.begin(9600); | |
pinMode(7, OUTPUT); //Left Plate | |
pinMode(6, OUTPUT); //Right plate | |
} | |
int sens_flip = 0; | |
int av = 0; | |
void loop() { |