Skip to content

Instantly share code, notes, and snippets.

@saikyun
saikyun / zig_watch.clj
Last active April 8, 2021 09:40
babashka command to watch a folder for changes to .zig-files
#!/usr/bin/env bb
(if *command-line-args*
(def in (str (first *command-line-args*)))
(do
(println "Which bin to run?")
(def in (str *input*))))
(println "Watching" "*.zig" "->" (str "./" in))
@saikyun
saikyun / readme
Created June 12, 2020 12:13
calling c from clojure using graalvm
// tested using graalvm 20.2 dev
// https://github.com/graalvm/graalvm-ce-dev-builds/releases
// thanks u/duhace for https://www.reddit.com/r/java/comments/8s7sr8/interacting_with_c_using_graalvm/
main.c
====
#include <stdio.h>
void printHello() {
FILE *f = fopen("file.txt", "w");
@saikyun
saikyun / README.md
Last active January 11, 2021 03:27
Getting started with clojure / calva
;;; -*- lexical-binding: t -*-
(require 'company)
(with-eval-after-load "company"
;; everywhere
(global-company-mode)
;;
;;(global-set-key (kbd "<tab>") #'helm-company)
(global-set-key (kbd "M-TAB") #'company-complete)
@saikyun
saikyun / main.janet
Last active November 26, 2020 19:40
repling with jaylib
# build jaylib (or use it as a dependency if you can)
# run `janet main.janet`
# in another terminal, run `janet main.janet connect`
# then modify and eval the `(defn frame ...)` form
# then run `(set frame-f frame)`
(use ./build/jaylib)
(import spork/netrepl)
(var font nil)
/*******************************************************************************************
*
* raylib [core] example - Basic window
*
* Welcome to raylib!
*
* To test examples, just press F6 and execute raylib_compile_execute script
* Note that compiled executable is placed in the same folder as .c file
*
* You can find all basic examples on C:\raylib\raylib\examples folder or
/*******************************************************************************************
*
* raylib [core] example - Basic window
*
* Welcome to raylib!
*
* To test examples, just press F6 and execute raylib_compile_execute script
* Note that compiled executable is placed in the same folder as .c file
*
* You can find all basic examples on C:\raylib\raylib\examples folder or
@saikyun
saikyun / deps.edn
Last active February 10, 2021 14:04
import csv into sql server
{:deps {seancorfield/next.jdbc {:mvn/version "1.0.13"}
org.clojure/data.csv {:mvn/version "1.0.0"}
clojure.java-time {:mvn/version "0.3.2"}
com.microsoft.sqlserver/mssql-jdbc {:mvn/version "8.2.0.jre8"}}}
(use ./build/jaylib)
(set-config-flags
:msaa-4x-hint)
(init-window 800 600 "Chart")
(init-audio-device)
(set-target-fps 60)
(def current-animations @{})
41.09 How to handle focus
Kinds of focus
- Mouse clicks
- Hover
- Drag
- Keyboard handling
- (Re)rendering
How to detect focus