Last active
January 9, 2024 15:50
-
-
Save Jpoliachik/41c6033a3405a00d8c69cc0f2c02edcd to your computer and use it in GitHub Desktop.
Revisions
-
Jpoliachik revised this gist
Jan 9, 2024 . 1 changed file with 0 additions and 35 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,35 +0,0 @@ -
Jpoliachik revised this gist
Jan 9, 2024 . 1 changed file with 0 additions and 29 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,29 +0,0 @@ -
Jpoliachik revised this gist
Jan 9, 2024 . 1 changed file with 29 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ const entities = { amp: "&", apos: "'", lt: "<", gt: ">", quot: '"', nbsp: "\xa0", ouml: "ö", auml: "ä", uuml: "ü", oacute: "ó", aacute: "á", eacute: "é", ntilde: "ñ", "#039": "'", } const entityPattern = /&(([a-z0-9]|#)+);/gi export const decodeHTMLEntities = (text: string): string => { // A single replace pass with a static RegExp is faster than a loop return text.replace(entityPattern, (match, entity) => { entity = entity.toLowerCase() if (Object.prototype.hasOwnProperty.call(entities, entity)) { return entities[entity as keyof typeof entities] } // return original string if there is no matching entity (no replace) return match }) } -
Jpoliachik revised this gist
Jan 9, 2024 . 1 changed file with 16 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ ... import shuffle from "lodash.shuffle" ... ... export const QuestionModel = types ... .views((self) => ({ get allAnswers() { return shuffle([ ...self.incorrectAnswers, ...(self.correctAnswer ? [self.correctAnswer] : []), ]) }, })) ... -
Jpoliachik created this gist
Jan 9, 2024 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ import React, { FC } from "react" import { observer } from "mobx-react-lite" import { TextStyle, View, ViewStyle } from "react-native" import { AppStackScreenProps } from "app/navigators" import { Screen, Text } from "app/components" import { spacing } from "app/theme" // import { useNavigation } from "@react-navigation/native" // import { useStores } from "app/models" interface QuestionScreenProps extends AppStackScreenProps<"Question"> {} export const QuestionScreen: FC<QuestionScreenProps> = observer(function QuestionScreen() { // Pull in one of our MST stores // const { someStore, anotherStore } = useStores() // Pull in navigation via hook // const navigation = useNavigation() return ( <Screen style={$root} preset="scroll"> <View style={$header}> <Text preset="heading" text="question" tx={"questionScreen.title"} /> </View> </Screen> ) }) const $root: ViewStyle = { flex: 1, paddingHorizontal: spacing.lg, } const $header: TextStyle = { marginTop: spacing.xxxl, marginBottom: spacing.md, }