Skip to content

Instantly share code, notes, and snippets.

View ORESoftware's full-sized avatar
🏐
Focusing

Alexander Mills ORESoftware

🏐
Focusing
View GitHub Profile
@ORESoftware
ORESoftware / gist:d74b1e6ffd7f02fd658d28c5597a3367
Created March 9, 2025 01:22
drizzle ORM command results in truncating table

doing migration with Drizzle ORM delete/truncated all data from our "skills" table:

ALTER TABLE "skills" ALTER COLUMN "default_val" SET DEFAULT '{"value":1}';
ALTER TABLE "skills" ALTER COLUMN "skill_desc" SET DATA TYPE jsonb;
ALTER TABLE "skills" ALTER COLUMN "skill_desc" SET DEFAULT '[]'::jsonb;
ALTER TABLE "skills" ALTER COLUMN "skill_desc" SET NOT NULL;
ALTER TABLE "skills" ALTER COLUMN "search_vector" SET DEFAULT ''::tsvector;
ALTER TABLE "skills" ALTER COLUMN "embedding" SET DEFAULT null;
⨯ [Error: {"error":{"error":{"name":"NeonDbError","sourceError":{}},"trace":"dd-trace-upsert-coach-profile"},"trace":"dd-trace-a6c5-f92d9122e890"}] {
digest: '1396788746'
}
@ORESoftware
ORESoftware / main.gleam
Created February 25, 2024 08:18
Main gleamlang file
import gleam_cowboy
import gleam/http.{Request, Response}
import gleam/http/response.{ok}
pub fn main() {
gleam_cowboy.start(fn(_req: Request) {
ok("Hello, Gleam!")
}, on_port: 3000)
}
@ORESoftware
ORESoftware / pool.md
Last active January 17, 2024 20:36
goroutine reuse for logging purposes

Code looks fine to me. There might be a hidden race condition. The p.Count++ and p.Count-- are atomic ops. For every ++ it's corresponding -- should be called TBD.

package pool

import (

we can use this domain middleware

const Domain = require('domain');

app.use((req,res,next) => {
@ORESoftware
ORESoftware / fixed.js
Last active December 27, 2022 09:53
here is fix for code
const getBBBMeetingInfo = async (meetingID) => {
const getMeetingInfo = api.monitoring.getMeetingInfo(meetingID);
const result = await bbb.http(getMeetingInfo);
result.meetingID = meetingID;
if(result.returncode == 'FAILED'){
updateNotificationCallStatus(meetingID)
}

This is some bad code, but illustrates the difficulty, futility, and pointlessness of implementing map/filter with Iterables.

Note that these are lazy (not eager). Nothing runs until the for..of is called on an instance, etc.

class IterableWMapFilter<T> {

  vals : T[]= [];
@ORESoftware
ORESoftware / server.js
Last active December 23, 2022 22:23
basic node server
const http = require('http');
const server = http.createServer((request, response) => {
response.end(`
<html> hello world this is julian, here is an image: <br>
<img src="https://static.wikia.nocookie.net/history/images/6/6a/Classical_greece..jpg"></img>
</html>
@ORESoftware
ORESoftware / iterable-int.md
Created December 22, 2022 01:59
iterable int in javascript / typescript

this code does what you'd expect and useful for avoiding unnecessary arrays (although a standard for-loop is usually fine...)

export class IterableInt {

  point = 0;
  start: number = 0;
  end: number = 0;
alex % test-sorted-numbers.js

0.003323905232836868516479445007663787423935061838055536238211856706
0.000003216665525946364975501189134992011094173428027265407092765945105
5.534929650272012720523268501945480556023094872405241335283017818e-8
9.145908272177229543705210160445544872490908442048180454092217671e-10
1.075675955494191912803286754291997208373252535492843752459149305e-11