Skip to content

Instantly share code, notes, and snippets.

View crisrojas's full-sized avatar

Cristian Felipe Patiño Rojas crisrojas

View GitHub Profile
@crisrojas
crisrojas / .js
Created March 25, 2024 14:37
Mini templates
/*
<each> tag for async fetch of a collection.
Just a toy playground for demo purposes of what I think would be a cool delcartive api to have,
so it misses a lot of important things (recursivity, for example)
Usage:
<each name="recipe" src="/data/recipes.json">
<view
src="/views/card.html"
#!/usr/bin/php
<?php
// Remove any existing "content" directory and re-create it
system("rm -r content");
system("mkdir -p content/images");
$db = new SQLite3("database.sqlite");
$result = $db->query("SELECT * FROM `ZSFNOTE` WHERE `ZTRASHED` LIKE '0'");
$row = $result->fetchArray();
$bear_img_dir = "Local Files/Note Images/";
@crisrojas
crisrojas / Nesteg hashtag parser.js
Last active February 16, 2023 22:04
Nested hashtag parser
// Used in my BearKit Project: https://notas.cristian.lat
// Attribution not required, but highly appreciated 🙏
class Tag {
constructor(name, slug, children) {
this.name = name
this.slug = slug
this.children = children
this.type = "tag"
}
import SwiftUI
struct ContentView: View {
@State var isOn: Bool = false
var body: some View {
VStack(spacing: 24) {
Toggle("Native SwiftU/UIKit toggle", isOn: $isOn)
import SwiftUI
struct ContentView: View {
@State private var showPanel = false
@Namespace private var namespace
var body: some View {
VStack {
Image(systemName: "globe")
@crisrojas
crisrojas / Khipu Counter.swift
Created February 3, 2023 00:21
Simple demo counter implemented with the Khipu architecture
import SwiftUI
fileprivate var store = createRamStore()
fileprivate var viewState = ViewState(store: store)
fileprivate var rootHandler = createCore(store: store)
@main
struct MyApp: App {
var body: some Scene {
WindowGroup {
import SwiftUI
@main
struct MyApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
import SwiftUI
@main
struct MyApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
@crisrojas
crisrojas / FixImages.swift
Created May 11, 2021 17:28
Fixing Bear images when batch exporting (markdown)
import Foundation
func main() {
let fileManager = FileManager.default
let path = fileManager.currentDirectoryPath
let url = URL(string: "file://" + path)
guard let enumerator = fileManager.enumerator(atPath: path) else {
fatalError("Directory doesn't exist")