Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Salihi prestancedesign

View GitHub Profile
View 006-deps-new-commands.md

Link to deps-new github.

Thank you, Sean Corfield!

Commands from the video

Install deps-new:

clj -Ttools install io.github.seancorfield/deps-new '{:git/tag "v0.4.13"}' :as new

@henryw374
henryw374 / kroki-read.bb
Last active July 4, 2022 17:50
encode and decode files as kroki url diagrams https://kroki.io/#try
View kroki-read.bb
#!/usr/local/bin/bb
(import '[java.io ByteArrayOutputStream])
(import '[java.util Base64]) ;
(import '[java.util.zip Inflater]) ;
(defn uncompress [source-bytes]
(let [inflater (doto (Inflater.)
(.setInput source-bytes))
outputStream (new ByteArrayOutputStream (count source-bytes))
View component_likes.md
@borkdude
borkdude / polyglot.cljs
Created January 31, 2022 10:15
GraalVM Node + nbb + JVM Clojure
View polyglot.cljs
$ $GRAALVM_HOME/bin/node --jvm --polyglot --vm.cp=$(clojure -Spath) $(which nbb)
user=> (.-version js/process)
"v14.18.1"
user=> (require '["path" :as path])
nil
user=> (path/resolve ".")
"/Users/borkdude"
user=> (def Clojure (js/Java.type "clojure.java.api.Clojure"))
#'user/Clojure
user=> (def clj:require (.var Clojure "clojure.core" "require"))
View guestbook.clj
(ns guestbook
(:require [cheshire.core :as cheshire]
[hiccup2.core :as hiccup]
[clojure.string :as str]))
(require '[babashka.pods :as pods])
(pods/load-pod "./pod-babashka-postgresql")
(def db {:dbtype "postgresql"
:user "guestbook"
@raspasov
raspasov / reanimated-v2-for-cljs.js
Created September 4, 2021 12:24
Reanimated v2 shim for CLJS
View reanimated-v2-for-cljs.js
import React, {useImperativeHandle, useRef, forwardRef} from 'react';
import Animated, {
useSharedValue,
useAnimatedStyle,
withTiming,
withSpring
} from 'react-native-reanimated';
function Box(props, ref) {
const aRef = useRef();
@didibus
didibus / clojure-right-tool.md
Last active January 31, 2023 19:13
When is Clojure "the right tool for the job"?
View clojure-right-tool.md

My answer to: https://www.reddit.com/r/Clojure/comments/pcwypb/us_engineers_love_to_say_the_right_tool_for_the/ which asked to know when and at what is Clojure "the right tool for the job"?

My take is that in general, the right tool for the job actually doesn't matter that much when it comes to programming language.

There are only a few cases where the options of tools that can do a sufficiently good job at the task become limited.

That's why they are called: General-purpose programming languages, because they can be used generally for most use cases without issues.

Let's look at some of the dimensions that make a difference and what I think of Clojure for them:

@borkdude
borkdude / gallery.cljs
Last active August 2, 2022 15:42 — forked from yogthos/gallery.cljs
script to download walpapers from windowsonearth.org, adapted for nbb
View gallery.cljs
@borkdude
borkdude / 1) bb.edn
Last active January 25, 2023 23:52
Work bb.edn files
View 1) bb.edn
{:tasks {:requires ([babashka.fs :as fs])
:init (do (when (seq (fs/modified-since "deps.edn"
["deps.template.edn"
"../base/deps.edn"]))
(shell {:dir ".."} "script/gen-deps.clj")))
;; Maintenance tasks
install {:doc "Install frontend dependencies from NPM"
:task (shell "npm install")}
clean {:doc "Clean all artifacts"
View bb_droplet_snapshot.clj
#!/bin/env/bb
;; script for creating DigitalOcean's droplet snapshot
(require '[babashka.curl :as curl])
(require '[cheshire.core :as json])
(def token (System/getenv "DO_TOKEN"))
(def droplet-id (System/getenv "DO_DROPLET_ID"))
(when (not token)