Skip to content

Instantly share code, notes, and snippets.

View juliooa's full-sized avatar

Julio Andres juliooa

View GitHub Profile
@juliooa
juliooa / similarity_function.sql
Created March 30, 2024 04:36
Similarity function for embeddings, to use in Supabase
CREATE OR REPLACE FUNCTION public.match_documents(
query_embedding vector,
match_threshold double precision,
match_count integer
) RETURNS TABLE(
id bigint,
content text,
similarity double precision,
metadata jsonb
) LANGUAGE sql STABLE AS $function$
@juliooa
juliooa / gist:45a51cae1307072063f1eba5518b8c10
Last active March 9, 2020 22:48
TextView.setExpandableText
fun TextView.setExpandableText(text: String, maxLines: Int, buttonsOnNewLines: Boolean = false) {
var layoutLaid = false
var layoutDisposable: Disposable? = null
setText(text)
post {
// If more than max lines are to be used for text, use "more-less" clickable
// labels in order to expand and collapse the text
if (lineCount > maxLines) {
// Temporarily set these values on the TextView.
@juliooa
juliooa / upload_image.py
Last active July 29, 2023 21:47
Python script to upload an image to Firebase storage through his url
#!/usr/bin/env python
import sys
import requests
import firebase_admin
from firebase_admin import credentials
from firebase_admin import storage
image_url = sys.argv[1] #we pass the url as an argument
cred = credentials.Certificate('path/to/certificate.json')
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
       String styleName = "StyleABC"; //Este nombre lo obtienes desde backend en alguna parte
int styleResourceId = getResources().getIdentifier(styleName, "style", getPackageName());
setTheme(style);
}