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 React, { useState } from 'react'; | |
| import { Select, Table } from './components'; // Assuming third-party components | |
| const App = () => { | |
| const [selectedLine, setSelectedLine] = useState('bakerloo'); | |
| const { data: lines } = useDataSource('https://api.tfl.gov.uk/line/mode/tube/status', []); | |
| const { | |
| data: tubeStations, | |
| loading, |
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
| // UI Controls Generator | |
| (function() { | |
| // Create a container for our controls | |
| const container = document.createElement('div'); | |
| container.id = 'ui-controls-container'; | |
| container.style.cssText = ` | |
| position: fixed; | |
| top: 20px; | |
| right: 20px; |
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 fs from 'node:fs' | |
| import path from 'node:path' | |
| let opts = {} | |
| process.argv.forEach(function (val, index, array) { | |
| if (val.startsWith('--')) { | |
| opts[val.slice(2)] = process.argv[index+1] | |
| } | |
| }); |
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
| <!doctype html> | |
| <body> | |
| <input :bind="interval" /> | |
| <input :bind="users" /> | |
| <p><span :text="interval"></span>s</p> | |
| <p><span :text="((1/interval) * 60 * 60 * 24 * 30 * users / 1_000_000)|0"></span>M requests / month</p> | |
| <script> | |
| const $ = (s) => document.querySelector(s) | |
| const $$ = (s) => Array.prototype.slice.call(document.querySelectorAll(s), 0) |
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 sequentialTest(control, treatment, sample) { | |
| if (treatment - control >= 2.25 * Math.sqrt(sample)) { | |
| return 'treatment wins' | |
| } else if (control - treatment >= 2.25 * Math.sqrt(sample)) { | |
| return 'control wins' | |
| } else if (treatment + control >= sample) { | |
| return 'stop test. no winner' | |
| } | |
| return 'continue testing' |
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 BUCKETS = 120 // multiple of 3 for correct split on 3-variant experiments | |
| const seed = '8fc40cab' // random seed, change to reallocate users | |
| function hashFNV(s, h = 0x811c9dc5) { | |
| for (let i = 0; i < s.length; i++) { | |
| h ^= s.charCodeAt(i); | |
| h += (h << 1) + (h << 4) + (h << 7) + (h << 8) + (h << 24); | |
| } | |
| return h >>> 0; | |
| } |
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
| // https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L9393C5-L9399C8 | |
| var groupBy = createAggregator(function(result, value, key) { | |
| if (hasOwnProperty.call(result, key)) { | |
| result[key].push(value); | |
| } else { | |
| baseAssignValue(result, key, [value]); | |
| } | |
| }); | |
| // https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L4818C5-L4825C6 |
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
| brew 'coreutils' | |
| brew 'tmux' | |
| brew 'jq' | |
| brew 'htop' | |
| brew 'wget' | |
| brew 'tree' | |
| brew 'aria2' | |
| brew 'xcbeautify' | |
| brew 'git' |
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
| <!doctype html> | |
| <body></body> | |
| <script> | |
| const events = [ | |
| 'click', | |
| 'input', | |
| 'change', | |
| 'mouseenter', | |
| 'mouseleave', |
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 { task, read, write } = require('taks') | |
| const _postcss = require('postcss') | |
| const _rollup = require('rollup') | |
| const _uglify = require('uglify-es') | |
| const postcss = task.plugin(async function (input, output, options) { | |
| let opts = Object.assign({ from: undefined, plugins: [] }, options) | |
| let src = await read(input) | |
| let { css } = await _postcss(opts.plugins).process(src, opts) | |
| return write(output, css) |
NewerOlder