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
// babel.config.js | |
module.exports = { | |
presets: ['@babel/preset-env', '@babel/preset-react', '@babel/preset-typescript'], | |
} |
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 React from 'react' | |
export const MyJSComponent = () => ( | |
<h2>Try out the counter below!</h2> | |
) |
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 React from 'react' | |
import { hot } from 'react-hot-loader/root' | |
import { MyJSComponent } from './components/MyJSComponent' | |
import { Counter } from './components/Counter' | |
export const App = hot(_App) | |
export function _App(): JSX.Element | null { | |
return ( | |
<div> | |
<h1>Hello world!</h1> |
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 React from 'react' | |
import ReactDOM from 'react-dom' | |
import { Provider } from 'react-redux' | |
import { getContext, resetContext } from 'kea' | |
import { App } from './App' | |
resetContext({ | |
createStore: {}, | |
plugins: [], | |
}) |
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> | |
<html> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" /> | |
<title>React from Scratch</title> | |
</head> | |
<body> | |
<div id="root"></div> | |
<noscript> You need to enable JavaScript to access this website. </noscript> |
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
{"uuid":"c284b820-38a1-11eb-a9ed-c36d0805c832","page":{"id":16370859,"data":{"appState":"[\"~#iR\",[\"^ \",\"n\",\"appTemplate\",\"v\",[\"^ \",\"isFetching\",false,\"plugins\",[\"~#iOM\",[\"query1\",[\"^0\",[\"^ \",\"n\",\"pluginTemplate\",\"v\",[\"^ \",\"id\",\"query1\",\"type\",\"datasource\",\"subtype\",\"SqlQueryUnified\",\"namespace\",null,\"resourceName\",\"PH Playground DB\",\"template\",[\"^3\",[\"queryRefreshTime\",\"\",\"records\",\"\",\"databasePasswordOverride\",\"\",\"queryDisabledMessage\",\"\",\"successMessage\",\"\",\"queryDisabled\",\"\",\"playgroundQuerySaveId\",0,\"resourceNameOverride\",\"\",\"runWhenModelUpdates\",true,\"query\",\"select * from posthog_event;\",\"playgroundQueryUuid\",\"\",\"playgroundQueryId\",0,\"privateParams\",[\"~#iL\",[]],\"triggersOnSuccess\",[\"^9\",[]],\"runWhenPageLoadsDelay\",\"\",\"warningCodes\",[\"^9\",[]],\"data\",null,\"recordId\",\"\",\"importedQueryInputs\",[\"^3\",[]],\"showSuccessConfetti\",false,\"isImported\",false,\"showSuccessToaster\",true,\"dataA |
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 resultElementFlag1 = document.getElementById('result-flag-1') | |
const resultElementFlag2 = document.getElementById('result-flag-2') | |
const iceCreamSelectorElement = document.getElementById('select-ice-cream') | |
const savePreferenceElement = document.getElementById('save-preference-btn') | |
const loadingRingElement = document.getElementById('loading-ring') | |
let loadingRingOn = false | |
posthog.init('sTMFPsFhdP1Ssg', { api_host: 'https://app.posthog.com', loaded: () => { updateFeatureFlagsDisplay(0) } }) | |
const updateFeatureFlagsDisplay = (timeout) => { |
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
# Property filtering logic omitted | |
# Rollout percentage logic: | |
__LONG_SCALE__ = float(0xFFFFFFFFFFFFFFF) | |
def _hash(self, key: str, distinct_id: str) -> float: | |
hash_key = "%s.%s" % (key, distinct_id) | |
hash_val = int(hashlib.sha1(hash_key.encode("utf-8")).hexdigest()[:15], 16) | |
return hash_val / __LONG_SCALE__ |
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
proc sum(arr: openArray[int]): int = | |
for num in arr: | |
result += num |
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
proc double[T](x: T): T {.inline, noSideEffects.} = | |
2 * x |