This file contains hidden or 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
| var Const = function(x) { return new _Const(x); }; | |
| var _Const = function(val) { this.val = val; }; | |
| _Const.prototype.inspect = function(){ return 'Const('+inspect(this.val)+')'; } | |
| var Add = function(x, y) { return new _Add(x, y); }; | |
| var _Add = function(x, y) { | |
| this.x = x; | |
| this.y = y; | |
| }; | |
| _Add.prototype.inspect = function(){ return 'Add('+inspect(this.x)+', '+inspect(this.y)+')'; } |
This file contains hidden or 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
| import { removeAccents } from './languageTools'; | |
| import { indexOf } from 'lodash'; | |
| type LangShortCode = ('en-AU' | 'en-CA' | 'en-GH' | 'en-GB' | 'en-IN' | 'en-IE' | 'en-KE' | 'en-NZ' | 'en-NG' | 'en-PH' | 'en-ZA' | 'en-TZ' | 'en-US' | 'es-AR' | 'es-BO' | 'es-CL' | 'es-CO' | 'es-CR' | 'es-EC' | 'es-SV' | 'es-ES' | 'es-US' | 'es-GT' | 'es-HN' | 'es-MX' | 'es-NI' | 'es-PA' | 'es-PY' | 'es-PE' | 'es-PR' | 'es-DO' | 'es-UY' | 'es-VE'); | |
| const listen = (lang: LangShortCode = 'en-US') => (grammars: string[] = []) => (condition: (SpeechRecognitionEvent) => boolean = () => true): Promise<SpeechRecognitionEvent> => | |
| new Promise((resolve, reject) => { | |
| var recognition = new webkitSpeechRecognition(); | |
| recognition.lang = lang; |
This file contains hidden or 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
| .batteryResultsList > ul:before { | |
| content: ''; | |
| display: block; | |
| position: relative; | |
| height: 10px; | |
| width: 10px; | |
| border-radius: 10px; | |
| left: -1rem; | |
| top: 0.85rem; | |
| } |
This file contains hidden or 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
| function randomSelection<T>(numToSelect: number, list: T[]): T[] { | |
| return take(numToSelect, randomizeList(range(0, list.length))) | |
| .map((i) => list[i]); | |
| } | |
| function randomizeList<T>(xs: T[], randomized: T[] = []): T[] { | |
| if (xs.length) { | |
| const {arr, val} = slice(Math.floor(Math.random() * xs.length), xs); | |
| return randomizeList(arr, randomized.concat([val])); | |
| } | |
| return randomized; |
This file contains hidden or 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
| interface CardAnswer { | |
| [key: string]: (boolean | number | date) | |
| hesitationDetected: boolean; | |
| correct: boolean; | |
| timeSpent: number; | |
| date: date; | |
| ef?: number; | |
| interval?: number; | |
| } |
This file contains hidden or 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 answers: CardAnswer[] = [ | |
| { | |
| "hesitationDetected": true, | |
| "correct": true, | |
| "timeSpent": 5000, | |
| "date": new Date("2018-11-01T15:13:00.000Z") | |
| }, | |
| { | |
| "hesitationDetected": false, | |
| "correct": false, |
This file contains hidden or 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
| CREATE TABLE `WordLists` ( | |
| `id` int NOT NULL AUTO_INCREMENT, | |
| `name` varchar(100) NOT NULL, | |
| `description` varchar(300), | |
| PRIMARY KEY (`id`) | |
| ); | |
| CREATE TABLE `WordGroups` ( | |
| `id` int NOT NULL AUTO_INCREMENT, | |
| `wordListId` int NOT NULL, |
This file contains hidden or 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
| SELECT | |
| Asses.id, | |
| Groups.orderNum, | |
| Defs.phrase, Defs.definition AS translation, | |
| Items.phrase, Items.translation | |
| FROM WordGroups AS Groups | |
| INNER JOIN WordListAssignments AS Asses | |
| ON Groups.id = Asses.wordGroupId | |
| AND Groups.wordListId = 1 | |
| INNER JOIN WordListItems AS Items |
This file contains hidden or 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
| type Card = { | |
| id: number, | |
| phrase: string, | |
| translation: string, | |
| }; | |
| type CardQueue = Card[] | "Completed"; | |
| type CardQueues = [CardQueue, CardQueue]; | |
| type UpdatedQueues = { | |
| updatedAt: Date, | |
| queues: CardQueues, |
This file contains hidden or 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
| type Tuple<T, U> = [T, U]; | |
| type Predicate<T> = (value: T) => boolean; | |
| type Callback<T, U> = (value: T) => U; | |
| type Route<T, U> = <V>( | |
| predicate: Predicate<T>, | |
| callback: Callback<T, V> | |
| ) => RouteResponse<T, U | V>; | |
| interface RouteResponse<T, U> { |