{ "@context":"https://www.w3.org/ns/activitystreams", "type":"Collection", "id":"https://epiktistes.com/objects/JQZ_3Cszplw/thread", "items":[ { "@context":[ "https://www.w3.org/ns/activitystreams", {"Hashtag":"as:Hashtag"} ], "published":"2023-01-29T14:50:38.076Z", "attributedTo":"https://epiktistes.com/actors/toddsundsted", "to":["https://www.w3.org/ns/activitystreams#Public"], "cc":["https://epiktistes.com/actors/toddsundsted/followers"], "content":"

one of the crystal programming language’s greatest strengths is the ease with which you can work with c apis and external libraries without leaving crystal. you can even implement callbacks in crystal!

in sqlite you can define new functions—callable from sql—with sqlite3_create_function by providing a name and a callback that implements the function. i created a new function called strip, entirely in crystal, that removes html markup and leaves text. it can be used in a sql query like so:

select * from objects\r\nwhere strip(content) like \"%term%\"

it’s part of the recently released content filtering code.

#crystallang #ktistec

", "mediaType":"text/html", "attachment":[], "tag":[ {"type":"Hashtag","name":"#crystallang","href":"https://epiktistes.com/tags/crystallang"}, {"type":"Hashtag","name":"#ktistec","href":"https://epiktistes.com/tags/ktistec"} ], "type":"Note", "id":"https://epiktistes.com/objects/tSAFQQY4_xM" } , { "@context":[ "https://www.w3.org/ns/activitystreams", {"Hashtag":"as:Hashtag"} ], "published":"2023-01-29T16:33:32.000Z", "attributedTo":"https://zomglol.wtf/users/jamie", "inReplyTo":"https://epiktistes.com/objects/tSAFQQY4_xM", "replies":"https://zomglol.wtf/users/jamie/statuses/109773456181206339/replies", "to":["https://www.w3.org/ns/activitystreams#Public"], "cc":["https://zomglol.wtf/users/jamie/followers","https://epiktistes.com/actors/toddsundsted"], "content":"

@toddsundsted This is incredible. I completely forgot we could pass procs to C functions that take function pointers, and then I remembered that the `XML` library does this, too, to talk to libxml2. https://github.com/crystal-lang/crystal/blob/b6c49c400a351095df051871db3a88504a64c791/src/xml.cr#L63-L66

", "attachment":[], "tag":[ {"type":"Mention","name":"@toddsundsted@epiktistes.com","href":"https://epiktistes.com/actors/toddsundsted"} ], "url":["https://zomglol.wtf/@jamie/109773456181206339"], "type":"Note", "id":"https://zomglol.wtf/users/jamie/statuses/109773456181206339" } , { "@context":[ "https://www.w3.org/ns/activitystreams", {"Hashtag":"as:Hashtag"} ], "published":"2023-01-29T16:39:46.545Z", "attributedTo":"https://epiktistes.com/actors/toddsundsted", "inReplyTo":"https://zomglol.wtf/users/jamie/statuses/109773456181206339", "to":["https://www.w3.org/ns/activitystreams#Public","https://zomglol.wtf/users/jamie"], "cc":["https://epiktistes.com/actors/toddsundsted/followers"], "content":"

@jamie tbh honest, i didn't want to go this route because i thought it was going to be a huge pain, but it turned out to just work!

", "mediaType":"text/html", "attachment":[], "tag":[ {"type":"Mention","name":"@jamie@zomglol.wtf","href":"https://zomglol.wtf/users/jamie"} ], "type":"Note", "id":"https://epiktistes.com/objects/JQZ_3Cszplw" } ] }