Skip to content

Instantly share code, notes, and snippets.

@nrfm
nrfm / basic_ui_documented.py
Created October 17, 2022 20:20 — forked from tin2tin/basic_ui_documented.py
A commented template for making simple UI in blender using the bpy python API
#import the bpy module to access blender API
import bpy
#WARNING: this is written and tested for blender 2.79
#blender 2.8 and newer will likely have a different python API
#create a property group, this is REALLY needed so that operators
#AND the UI can access, display and expose it to the user to change
#in here we will have all properties(variables) that is neccessary
class CustomPropertyGroup(bpy.types.PropertyGroup):
@nrfm
nrfm / private_fork.md
Created January 16, 2022 18:02 — forked from 0xjac/private_fork.md
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

<section class="text-gray-700 body-font">
<div class="container px-5 py-24 mx-auto">
<div class="flex flex-wrap -m-4">
<div class="p-4 md:w-1/3">
<div class="h-full border-2 border-gray-200 rounded-lg overflow-hidden">
<img class="lg:h-48 md:h-36 w-full object-cover object-center" src="https://dummyimage.com/720x400" alt="blog"/>
<div class="p-6">
<h2 class="tracking-widest text-xs title-font font-medium text-gray-500 mb-1">CATEGORY</h2>
<h1 class="title-font text-lg font-medium text-gray-900 mb-3">The Catalyzer</h1>
<p class="leading-relaxed mb-3">Photo booth fam kinfolk cold-pressed sriracha leggings jianbing microdosing tousled waistcoat.</p>
(defn ->graph [g gr parent]
(let [l (or (:id g) (key g))
initial (or (:initial g) (-> g last :initial))
#_#__ (.log js/console "---- " initial (-> g last :initial))
n (name l)
{:keys [nodes edges]} gr
nodes' (conj nodes (let [] {:data {:id n :label n :parent parent}}))
edges' (into [] (concat edges
(if-let [on (:on (second g))]
(map
@nrfm
nrfm / rnd.cljs
Created September 19, 2020 17:33
(h/load-jspm-native-modules ["react-rnd"])
(def data
(r/atom {:notes [ {:id 1 :content [:div
[:video {:controls true :auto-play false}
[:source {:type "video/mp4"
:src "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"}]
"Your browser does not support the video tag."]
]}
{:id 2 :content [:div.bg-red-500 "z-index ordering is up to the developer add your z-index by sorting (data :notes)"]}]
@nrfm
nrfm / matterjs.cljs
Last active September 15, 2020 19:36
(defn sketch
[]
(let [engine' (.-Engine js/Matter)
render' (.-Render js/Matter)
world (.-World js/Matter)
bodies (.-Bodies js/Matter)
body (.-Body js/Matter)
engine (.create engine')
add (fn []
@nrfm
nrfm / cyto.cljs
Created September 15, 2020 14:55
(defn gg
[{:keys [id graph style layout] :or {style {} layout {}}}]
(let [cy (r/atom nil)
opts {:style style
:layout layout}
on-update (fn [c] (js/console.log @cy))
on-mount (fn [c]
(js/setTimeout
(fn []
(defn tone-sketch
[{:keys [sketch]}]
[h/js-loader {:scripts {#(and (exists? js/Tone))
(str "https://cdnjs.cloudflare.com/ajax/libs/tone/14.5.40/Tone.js")}
:loading [:div "Loading..."]
:loaded [:div sketch]}])
(defn sketch
[]
(let [synth (.toMaster (.chain (new js/Tone.Synth)))

This is probably going to be the next iteration of the declarative CRUD metamodel that powers Hyperfiddle. It's just a design sketch, the current metamodel in prod is different. Hyperfiddle is an easy way to make a CRUD app. Hyperfiddle is based on Datomic, a simple graph database with the goal of "enabling declarative data programming in applications."

CRUD UI definition

This extends Datomic pull syntax into something that composes in richer ways. The key idea is that Pull notation expresses implicit joins and thus can be used to declare data dependencies implicitly, without needing to name them. We also handle tempids, named transactions, and hyperlinks to other pages. We satisfy the hypermedia constraint, like HTML and the web.

{identity                                                   ; Pass through URL params to query
 [{:dustingetz/event-registration                           ; virtual attribute identif

example loading a lib from the gist