- Step 1
- Step 2
- Step 2a
- Step 2b
| error: lifetime may not live long enough | |
| --> src/main.rs:72:46 | |
| | | |
| 63 | impl<'a, T: AsyncReadExt + std::marker::Unpin, U: databento::dbn::HasRType + 'a> Stream | |
| | -- lifetime `'a` defined here | |
| ... | |
| 68 | fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll<Option<Self::Item>> { | |
| | - let's call the lifetime of this reference `'1` | |
| ... | |
| 72 | Poll::Ready(Ok(Some(result))) => Poll::Ready(Some(Ok(result))), |
| param( | |
| [string]$inputFilePath, | |
| [string]$configFilePath | |
| ) | |
| if (-not $inputFilePath) { | |
| Write-Host "Please provide a valid input file path" | |
| exit | |
| } |
| import { __testVisible as self } from './index.mjs'; | |
| function a() { | |
| return 1; | |
| } | |
| export function b() { | |
| return self.a(); | |
| } |
It's never been easier to elevate your latest project from your laptop to the Internet, allowing you to show your proof of concept to anyone with a simple url. However, some pieces of the puzzle have remained frustratingly difficult to place without relying on a paid service. For me, that piece was the persistence layer. I've always been a big fan of SQL, and Postgres in particular. Simple enough for the simplest MVP, and reliably consistent enough for business-critical data, it's a piece of tech I learned once and have used in every project since. Unfortunately, free database offerings are far less common than free static file hosts.
| const pq = []; | |
| function enqueue(value, priority) { | |
| const item = { value, priority }; | |
| for (let i = 0; i < pq.length; i++) { | |
| const { value: pqValue, priority: pqPriority } = pq[i]; | |
| // Maintain min-heap, sorted by (value, priority) | |
| if (value < pqValue || (value === pqValue && priority < pqPriority)) { | |
| pq.splice(i, 0, item); | |
| return; |
| const values = [5, 4, 4, 4, 4, 0, 0, 0, -1, -1, -1, -3]; | |
| const k = 20; | |
| function main() { | |
| // Build a lookup of value frequencies, and calculate the best combo | |
| let bestCombo = 0; | |
| const frequencies = {}; | |
| for (const value of values) { | |
| const absValue = Math.abs(value); | |
| if (!frequencies[absValue]) { |
| import { useStore, component$ } from '@builder.io/qwik'; | |
| import axios from 'axios'; | |
| export const Main = component$(async () => { | |
| const response = await axios.get('https://httpbin.org/') | |
| const state = useStore({ name: 'World', status: response.status }); | |
| return ( | |
| <p>Status: {state.status}</p> | |
| ); | |
| }); |
The various search patterns afforded to customers make it challenging to generally optimize the query performed by the /admin/record endpoint.
This gist explores several strategies that offer significant improvement for specific query patterns.
| // New cursor format | |
| const cursor = (record, columnName) => base64.encode(JSON.stringify({ | |
| name: record.constructor.name, | |
| columnName, | |
| value: record[columnName], | |
| recordId: record.id | |
| })) | |
| // Paginate based on (potentially not unique) cursor column value, as well as (unique) record id | |
| if (connection?.before) { |