Skip to content

Instantly share code, notes, and snippets.

View ydrea's full-sized avatar
💭
innit :D

Andrija Vranic ydrea

💭
innit :D
View GitHub Profile
@ydrea
ydrea / ar-machina
Last active May 14, 2026 16:18
ydrea's ar machine
// scripts/machina.ts
export type Vec3 = { x: number; y: number; z: number };
export type IslandInput = {
id: string;
name: string;
lat: number;
lng: number;
elevation?: number;
const fs = require("fs");
const path = require("path");
// CONFIG
const PRECISION = 1e5; // quantization
const LODS = {
far: 0.01,
mid: 0.001,
near: 0,
@ydrea
ydrea / genassets.js
Last active December 29, 2025 09:54
// genassets.js
import { generateImageAsync } from '@expo/image-utils';
import fs from 'fs/promises';
import path from 'path';
import readline from 'readline';
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
const { getDefaultConfig } = require('expo/metro-config');
/** @type {import('expo/metro-config').MetroConfig} */
const config = getDefaultConfig(__dirname);
// Keep your custom source extension if needed
if (config.resolver.sourceExts && !config.resolver.sourceExts.includes('sql')) {
config.resolver.sourceExts.push('sql');
}
@ydrea
ydrea / translations+interpolations.ts
Created August 21, 2025 14:11
i18n UI translations
// translations+interpolations.ts
function defineTranslations<
T extends Record<string, Record<string, string>>
>(t: T & Record<keyof T, Record<keyof T[keyof T], string>>) {
return t;
}
export const translations = defineTranslations({
en: {
hello: "Hello",
document.addEventListener("DOMContentLoaded", function() {
var links = document.querySelectorAll('a');
for (var i = 0; i < links.length; i++) {
var link = links[i];
if (link.href.indexOf('http://andrija-vranic.from.hr') === 0) {
link.href = link.href.replace('http://', 'https://');
}
}
});
@ydrea
ydrea / App.js
Created June 22, 2025 20:18 — forked from jamesgpearce/App.js
Modified version of TinyBase Expo example to demonstrate synchronization. This updates https://github.com/expo/examples/tree/master/with-tinybase
import { useCallback, useState } from 'react';
import * as SQLite from 'expo-sqlite';
import {
FlatList,
Platform,
StyleSheet,
Text,
TextInput,
TouchableOpacity,
} from 'react-native';
@ydrea
ydrea / thumbnailer.py
Created May 21, 2025 00:30 — forked from aarongundel/thumbnailer.py
Arches Simple Thumbnailer
from PIL import Image
import filetype
class SimpleThumbnailer(ThumbnailGenerator):
IMAGES = (
'png', 'jpg', 'jpeg', 'jpe', 'gif', 'bmp', 'dib', 'dcx',
'eps', 'ps', 'im', 'pcd', 'pcx', 'pbm', 'pbm', 'ppm',
'psd', 'tif', 'tiff', 'xbm', 'xpm',
)
def make_thumbnail(self, inputfile_path, outputfile_path, **kwargs):
@ydrea
ydrea / L.TileLayer.BetterWMS.js
Created November 10, 2024 22:08
BetterWMS + HTML popups
//https://gist.github.com/rclark/6908938?permalink_comment_id=4749563#gistcomment-4749563
// with thumbs
showGetFeatureInfo: function (
err,
latlng,
content
// signaturaFromUrl
) {
if (err) {