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.
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
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))), |
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
param( | |
[string]$inputFilePath, | |
[string]$configFilePath | |
) | |
if (-not $inputFilePath) { | |
Write-Host "Please provide a valid input file path" | |
exit | |
} |
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 { __testVisible as self } from './index.mjs'; | |
function a() { | |
return 1; | |
} | |
export function b() { | |
return self.a(); | |
} |
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 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; |
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 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]) { |
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 { 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.
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
// 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) { |
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
ARGS { | |
input: [Object: null prototype] { | |
eventId: '969356d5-6156-4064-a754-b4d6399186de', | |
userId: 'auth0|609c4d9117bcf2007065def6', | |
role: 'creator' | |
} | |
} | |
HOST ROLE UPDATE | |
DEMOTED CREATOR auth0|5d9cf8731aa11a0c5bac758e | |
PROMOTED COHOST auth0|609c4d9117bcf2007065def6 |
NewerOlder