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 addDayTest(day, tz) { | |
| const start = moment.tz(day, 'YYYY-MM-DD', tz); | |
| const plusDay = start.clone().add(1, 'day'); // Next calendar day at same time. | |
| const plusHours = start.clone().add(24, 'hours'); // 24 hours in the future. | |
| return { | |
| start: start.valueOf() / 1000, | |
| plusDay: plusDay.valueOf() / 1000, | |
| plusHours: plusHours.valueOf() / 1000, | |
| diff: (plusHours - plusDay) / 1000, // How different are "1 day" and "24 hours"? | |
| }; |
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
| #!/bin/bash | |
| ## aws-amplify-react-native uses a weird export syntax that breaks our jest/babel config: | |
| ## https://github.com/aws-amplify/amplify-js/issues/2686 | |
| ## https://github.com/aws-amplify/amplify-js/pull/3102 | |
| ## This fix just edits those files to use a more normal syntax. | |
| function fix_imports() { |
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
| let global_currentHooks: object[] | null = null; | |
| let global_currentHookIndex: number | null = null; | |
| function getNextHook() { | |
| return global_currentHooks![global_currentHookIndex!]; | |
| } | |
| const state = new Map(); |
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
| // build a safe, comparable string from a semver! | |
| function semver(str) { | |
| const bits = str.split('.'); | |
| const padLength = 1 + Math.max(...bits.map(s => s.length)); | |
| return bits.map(s => s.padStart(padLength, '0')).join(''); | |
| } |
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
| // Get the types of all properties of T: | |
| type Values<T> = T[keyof T]; |
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 FilterFn<T> = (item: T) => boolean; | |
| type FilterMap<T> = Record<string, FilterFn<T>>; | |
| function filterMap<T, U extends FilterMap<T>>(items: T[], filterMap: U) { | |
| const filters = new Map<string, FilterFn<T>>(); | |
| Object.keys(filterMap).forEach((key) => filters.set(key, filterMap[key])); | |
| const itemMap: Partial<Record<keyof U, T>> = {}; | |
| for (const item of items) { | |
| const matchedFilter = Array.from(filters).find(([key, filterFn]) => { |
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 fs = require('fs'); | |
| const crateData = JSON.parse(fs.readFileSync('crates-neater.json', 'utf-8')); | |
| function crateWithAny(data) { | |
| const itemNames = typeof data == 'string' ? Array.from(arguments) : data; | |
| return crateData.filter(crate => itemNames.reduce((hasItem, item) => hasItem || item in crate, false)); | |
| } | |
| const l3cc = crateWithAny('Level 3 Backpack', 'Level 3 Helmet', 'Level 3 Military Vest').length; |
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
| Verifying I am +prodigysim on my passcard. https://onename.com/prodigysim |
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
| /* | |
| Finale Can't Spawn Glitch Fix (C) 2014 Michael Busby | |
| All trademarks are property of their respective owners. | |
| This program is free software: you can redistribute it and/or modify it | |
| under the terms of the GNU General Public License as published by the | |
| Free Software Foundation, either version 3 of the License, or (at your | |
| option) any later version. | |
| This program is distributed in the hope that it will be useful, but |
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
| // Reverse-engineered CTerrorPlayer::UpdateZombieFrustration(). | |
| // I can claim no copyright for this code. | |
| // This representation of code was produced by reverse engineering for interoperability. | |
| // Any resemblance to original source is completely accidental. | |
| void CTerrorPlayer::UpdateZombieFrustration() | |
| { | |
| if ( !ZombieFrustration.GetBool()) | |
| || this->GetTeamNumber() != 3 | |
| || this->GetClass() != 8 |