View index.html
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
<!DOCTYPE html> | |
<!-- | |
Open this file in Safari | |
Open the developer tools | |
Refresh the page | |
Observe crash in "Anonymous Script" function "containsSchemaOrgMarkup" | |
--> | |
<script type="application/ld+json"> | |
[] | |
</script> |
View colors.js
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
import { | |
PlatformColor, | |
DynamicColorIOS as BaseDynamicColorIOS, | |
Platform | |
} from 'react-native' | |
// Stops this crashing when called on other platforms | |
const DynamicColorIOS = Platform.select({ | |
ios: BaseDynamicColorIOS, | |
default: () => null |
View colors.xml
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
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<color name="background">#FFFFFF</color> | |
<color name="color">#212121</color> | |
</resources> |
View DynamicColorIOS.jsx
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
import { DynamicColorIOS } from 'react-native' | |
const styles = StyleSheet.create({ | |
title: { | |
color: DynamicColorIOS({ | |
light: 'black', | |
dark: 'white' | |
}) | |
} | |
}) |
View useColorScheme.jsx
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
import { useColorScheme } from 'react-native' | |
const styles = StyleSheet.create({ | |
titleLight: { | |
color: 'black' | |
}, | |
titleDark: { | |
color: 'white' | |
} | |
}) |
View variant4.re
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
type scalar = [ | `Fraction(int, int) | `Decimal(float)]; | |
type value = [ scalar | `Vector(list(scalar)) | `nan]; | |
let addScalar = (a, b) => | |
switch (a, b) { | |
| (`Fraction(n1, d1), `Fraction(n2, d2)) => | |
`Fraction((n1 * d2 + n2 * d1, d1 * d2)) | |
| (`Fraction(n, d), `Decimal(f)) | |
| (`Decimal(f), `Fraction(n, d)) => | |
`Decimal(f *. float_of_int(n) /. float_of_int(d)) |
View variant4.re
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
type scalar = [ | `Fraction(int, int) | `Decimal(float)]; | |
type value = [ scalar | `Vector(list(scalar))]; | |
let addScalar = (a, b) => | |
switch (a, b) { | |
| (`Fraction(n1, d1), `Fraction(n2, d2)) => | |
`Fraction((n1 * d2 + n2 * d1, d1 * d2)) | |
| (`Fraction(n, d), `Decimal(f)) | |
| (`Decimal(f), `Fraction(n, d)) => | |
`Decimal(f *. float_of_int(n) /. float_of_int(d)) |
View variant3.re
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
type length = [ | `Meter | `Inch]; | |
type time = [ | `Second | `Minute | `Hour]; | |
type temperatureLinear = [ | `Kelvin]; | |
type temperatureNonLinear = [ | `Celsius]; | |
type unitLinear = [ length | time | temperatureLinear]; | |
type anyUnit = [ unitLinear | temperatureNonLinear]; | |
let siScale = (unit: unitLinear) => | |
switch (unit) { |
View variant2.re
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
type primary = [ | `Red | `Green | `Blue]; | |
type colorFunctions = [ | `Rgb(int, int, int) | `Hsl(int, int, int)]; | |
type colors = [ primary | colorFunctions]; |
View variant1.re
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
let firstBracketPair = inputChars => { | |
let rec iter = (currentState, chars, currentIndex) => | |
switch (currentState, chars) { | |
| (`FoundBracket(startIndex), [')', ..._]) => | |
Some((startIndex, currentIndex)) | |
| (_, ['(', ...tail]) => | |
iter(`FoundBracket(currentIndex), tail, currentIndex + 1) | |
| (_, [_, ...tail]) => | |
iter(currentState, tail, currentIndex + 1) | |
| (_, []) => |
NewerOlder