For anyone considering the use of ULIDs in MySQL with drizzle
, here's a ready-to-use ULID
type for your convenience.
import { Ulid as ULID } from "id128";
export const ulid = customType<{
data: string;
notNull: true;
default: false;
For anyone considering the use of ULIDs in MySQL with drizzle
, here's a ready-to-use ULID
type for your convenience.
import { Ulid as ULID } from "id128";
export const ulid = customType<{
data: string;
notNull: true;
default: false;
-- Based off IETF draft, https://datatracker.ietf.org/doc/draft-peabody-dispatch-new-uuid-format/ | |
create or replace function uuid_generate_v7() | |
returns uuid | |
as $$ | |
begin | |
-- use random v4 uuid as starting point (which has the same variant we need) | |
-- then overlay timestamp | |
-- then set version 7 by flipping the 2 and 1 bit in the version 4 string | |
return encode( |
class ApplicationJob < ActiveJob::Base | |
around_perform do |job, block| | |
Honeycomb.start_span(name: job.class.name) do |span| | |
span.add_field 'type', 'worker' | |
span.add_field 'queue.name', job.queue_name | |
block.call | |
end | |
end | |
end |
<!DOCTYPE html> | |
<html lang="pt-BR"> | |
<head> | |
<meta chatset="UTF-8" /> | |
<title>CSS Progress Bar</title> | |
<style> | |
.wrapper { | |
width: 500px; | |
} |
/** | |
* Example to refresh tokens using https://github.com/auth0/node-jsonwebtoken | |
* It was requested to be introduced at as part of the jsonwebtoken library, | |
* since we feel it does not add too much value but it will add code to mantain | |
* we won't include it. | |
* | |
* I create this gist just to help those who want to auto-refresh JWTs. | |
*/ | |
const jwt = require('jsonwebtoken'); |
#!/usr/bin/env xdg-open | |
[Desktop Entry] | |
Encoding=UTF-8 | |
Name=YakYak | |
Comment=Desktop client for Google Hangouts | |
GenericName=Hangouts Client | |
Exec=/opt/yakyak-linux-x64/yakyak | |
Icon=/opt/yakyak-linux-x64/resources/app/icons/[email protected] | |
Terminal=false |
FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.
Model.where("table_column LIKE :prefix", prefix: "#{keyword}%")
This gist had a far larger impact than I imagined it would, and apparently people are still finding it, so a quick update:
(async main(){...}())
as a substitute for TLA. This completely eliminates the blocking problem (yay!) but it's less powerful, and harder to statically analyse (boo). In other words the lack of TLA is causing real problemsI'll leave the rest of this document unedited, for archaeological
// Correct Way | |
function indexOf(str, query) { | |
for(var i = 0; i < str.length; i++) { | |
for(var q = 0; q < query.length; q++) { | |
if (str[i+q] !== query[q]) { | |
break; | |
} | |
if (q === query.length - 1) { | |
return i; | |
} |