Skip to content

Instantly share code, notes, and snippets.

View chientrm's full-sized avatar
🏠
Working from home

Chien Tran chientrm

🏠
Working from home
View GitHub Profile
@chientrm
chientrm / j3d_exporter.py
Last active January 6, 2022 06:05
Export blender model with texture to a single json file - Blender 3.0
import os
import bpy
import json
import base64
bl_info = {
"name": "json exporter",
"blender": (2, 80, 0),
"author": "Chien Tran",
"category": "Import-Export",
@chientrm
chientrm / gist:5be2812ae38208390cf60114bbfc1d75
Created June 17, 2022 12:08
init svelte project with express and esbuild
npm init svelte
npm install -D express esbuild
import express from 'express';
import { handler } from './handler.js';
const app = express();
app.get('/healthcheck', (_, res) => res.send('ok'));
app.use(handler);
app.listen(3001);
import { build } from 'esbuild';
build({
entryPoints: ['./index.js'],
bundle: true,
minify: true,
outfile: './build/index.js',
format: 'esm',
platform: 'node',
external: ['./handler.js'],
{
...
"scripts": {
...
"dist": "npm run build && node esbuild.js",
...
},
"type": "module"
}
@chientrm
chientrm / worker.js
Last active October 3, 2022 17:11
Sample CF Worker
const
_ = {
author : 'chientrm',
title : 'TODO list with CF Worker',
description : 'This project is done via quick edit only',
year : '2022',
keywords : 'cloudflare, worker, quick, edit',
license : 'MIT',
},
_________________________CONSTANTS_____________________________=_,
package site.chientrm.youwave.services.youwave
import com.google.firebase.auth.FirebaseAuth
import com.squareup.moshi.Moshi
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.tasks.await
import okhttp3.OkHttpClient
import retrofit2.Retrofit
import retrofit2.converter.moshi.MoshiConverterFactory
Scaffold(
snackbarHost = { SnackbarHost(snackbarHostState) },
bottomBar = {
NavigationBar {
val navBackStackEntry by navController.currentBackStackEntryFlow.collectAsState(null)
val currentDestination = navBackStackEntry?.destination
NavigationBarItem(
selected = currentDestination?.route == Routes.HOME,
onClick = {
navController.navigate(Routes.HOME) {
@chientrm
chientrm / worker.ts
Created August 15, 2023 07:33
mailshitpostai
import { array, object, string } from 'yup';
import { validate } from './validate';
import { Router, json, error } from 'itty-router';
export default {
async fetch(
request: Request,
env: Env,
ctx: ExecutionContext,
): Promise<Response> {
@chientrm
chientrm / gist:c1250422b982593c3ebd31ed35735e16
Created August 16, 2023 17:32 — forked from BjornDCode/gist:5cb836a6b23638d6d02f5cb6ed59a04a
Tailwind - Fixed sidebar, scrollable content
// Source: https://twitter.com/calebporzio/status/1151876736931549185
<div class="flex">
<aside class="h-screen sticky top-0">
// Fixed Sidebar
</aside>
<main>
// Content
</main>