Skip to content

Instantly share code, notes, and snippets.

@cldwalker
cldwalker / page-property-join-example-query
Created January 31, 2022 00:11
logseq page-property-join-example-query
- #+BEGIN_QUERY
{:title "Query joining page properties with a rule"
:query [:find (pull ?things [*])
:in $ ?region %
:where
(page-name-property ?_b ?country :region ?region)
(page-name-property ?_b2 ?author :country-of-origin ?country)
(page-name-property ?things ?_name :authored-by ?author)]
:inputs ["Middle East"
[[(page-name-property ?b ?block-name ?property-name ?property-value)
@cldwalker
cldwalker / logseq-join-query.md
Last active January 31, 2022 00:09
Example logseq queries of joining across blocks by user defined properties

This gist demonstrates joining across user defined block properties. To start, paste the following 3 blocks in Logseq:

- type:: person
  name:: foo
- type:: comment
  author:: foo
  text:: bar
- #+BEGIN_QUERY
  {:title "Query joining blocks by user defined properties"
@cldwalker
cldwalker / explore_datafy_nav.clj
Created August 11, 2020 06:03 — forked from sashton/explore_datafy_nav.clj
Clojure datafy/nav exploration
(ns explore-datafy-nav
"Sample code demonstrating naving around a random graph of data.
The graph very likely will have circular references, which is not a problem.
To see the results, execute the entire file.
Each step in the nav process will be printed out, as well as the initial db.
Subsequent executions will generate a new random db."
(:require [clojure.datafy :refer [datafy nav]]
[clojure.pprint]))
(defn generate-db
@cldwalker
cldwalker / spike-day-02-03-20.md
Last active June 19, 2024 04:24
GraalVM dive in Clojure at work

Spike

I looked into the state of GraalVM and Clojure and wrote some small work-related scripts.

GraalVM Build Tools

@cldwalker
cldwalker / knowledge-graph-experiment.md
Last active March 11, 2024 11:10
knowledge graph experiment

I like to learn, index and retrieve information a lot. I know a lot of others do as well. We share data but I don't think we share our information and rarely our ontologies (a.k.a. our mental models). If we shared our ontologies, I think we could learn more from each other. With this hope in mind, I'm looking for a tool that provides these features:

  • Shares my ontology publicly
  • Shares my bookmarks publicly
  • Provides easy entry, extension and querying of my ontology
  • Provides easy entry and querying of my bookmarks
  • Shares interesting snapshots of my bookmarks
  • Encourages discovery of information that is new and interesting to others

Since I have not found such a tool, I have built a tool that:

@cldwalker
cldwalker / gist:3043504e79c389bec5ebd2a4f4fa8a57
Last active April 29, 2020 14:06
ClojureScript ReactNative Unsession
(defroutes chapter-routes
;; Example story-slug: 42-my-first-story
;; Example chapter-slug: 99-introduction
;; (util/parse-uid "42-my-first-story") -> 42
;; (util/parse-uid "99-introduction") -> 99
(GET "/chapters/:chapter-slug" [story-slug chapter-slug]
(let [story (some-> story-slug util/parse-uid db/find-story-by-uid)
chapter (some-> chapter-slug util/parse-uid db/find-chapter-by-uid)]
(and story chapter
(zizkov.views/show-chapter layout story chapter)))))
@cldwalker
cldwalker / gist:4690642
Created February 1, 2013 10:54
Example lein grep search
Searching over Artifact ID...
+----------------------+-------------------------------+----------------+-----------------------------------------------------------------------------------------------------------------------------+
| artifact | group | version | desc |
+----------------------+-------------------------------+----------------+-----------------------------------------------------------------------------------------------------------------------------+
| lein-create-template | lein-create-template | 0.1.1 | A Leiningen plugin for creating templates from existing skeleton projects |
| lein-template | misaki | 0.0.1-alpha | FIXME: write description
@cldwalker
cldwalker / rails-overview.rb
Created July 20, 2011 06:47
Prints out a tree of classes and their methods for a rails project
#!/usr/bin/env ruby
# == Description
# Prints out a tree of classes and their methods for a rails project. Can be run from the
# root directory of a rails project or with a specified rails directory. By default
# this script only looks in the models, controllers and helpers directories for ruby classes but that can be
# configured.
#
# This was useful back in the day when Rails projects were small and I wanted to a quick overview of
# the project.