Skip to content

Instantly share code, notes, and snippets.

View zerg000000's full-sized avatar

Albert Lai zerg000000

View GitHub Profile
@jacobobryant
jacobobryant / howto.md
Last active December 9, 2023 00:24
How to let users upload images to S3 with Biff

How to let users upload images to S3 with Biff

UPDATE: Biff now includes a com.biffweb/s3-request function that can be used with the examples below, with some slight modifications.

Add the provided s3.clj file to your project, and set the following keys in config.edn and secrets.env:

;; config.edn
:s3/origin "https://nyc3.digitaloceanspaces.com"
:s3/edge "https://example.nyc3.cdn.digitaloceanspaces.com"
@inscapist
inscapist / tailwind.cljs
Last active November 15, 2022 00:36
ChakraUI inspired tailwind *layouts*, in reagent/hiccup
(ns myapp.tailwind
(:require
[clojure.spec.alpha :as s]
[clojure.string :as str]
[vl.config :as config]))
(s/def ::class (s/or :string string? :vector vector?))
(s/def ::cs sequential?) ;; shorthand for classes
(s/def ::dim #{:screen :fill :h :vh :w :vw})
(s/def ::position #{:x-center :y-center :center}) ;; position utils for relative elements
@spacegangster
spacegangster / timezones.edn
Last active July 15, 2020 14:52
List of standard timezones, scraped from a popular mailing service
;; UPD hey, I'm not sure now if those zones are correct throughout the year
;; see this https://www.creativedeletion.com/2015/01/28/falsehoods-programmers-date-time-zones.html
;; Sorry for misleading you
[{:option/value "Pacific/Tarawa" :option/label "(GMT +12:00) Tarawa"}
{:option/value "Pacific/Auckland" :option/label "(GMT +12:00) New Zealand Time"}
{:option/value "Pacific/Norfolk" :option/label "(GMT +11:00) Norfolk Island (Austl.)"}
{:option/value "Pacific/Noumea" :option/label "(GMT +11:00) Noumea, New Caledonia"}
{:option/value "Australia/Sydney" :option/label "(GMT +10:00) Australian Eastern Time (Sydney)"}
{:option/value "Australia/Queensland" :option/label "(GMT +10:00) Australian Eastern Time (Queensland)"}
{:option/value "Australia/Adelaide" :option/label "(GMT +9:30) Australian Central Time (Adelaide)"}
@yogthos
yogthos / clojure-beginner.md
Last active April 22, 2024 09:00
Clojure beginner resources

Introductory resources

@schmee
schmee / assembly.log
Created August 6, 2019 18:53
Vector API in Clojure!
vector_clj/core$i256_add.invoke(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; [0x000000011f8acdc0, 0x000000011f8ad058] 664 bytes
[Entry Point]
[Constants]
# {method} {0x000000013253d3b8} 'invoke' '(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;' in 'vector_clj/core$i256_add'
# this: rsi:rsi = 'vector_clj/core$i256_add'
# parm0: rdx:rdx = 'java/lang/Object'
# parm1: rcx:rcx = 'java/lang/Object'
# [sp+0x30] (sp of caller)
.....
0x000000011f8acec3: prefetchw BYTE PTR [r10+0x180]
@kachayev
kachayev / aleph-planning.md
Last active December 12, 2022 16:28
A few thoughts on Aleph development

Aleph, Async, HTTP, Clojure

I've been working with Aleph rougly for last 5 years, actively contributing to the library for last 2 (or so). I also put some effort into spreading the word about it, including educational tech talks, like "Deep HTTP Dive Throught Aleph & Netty". But the more I talk to people the more confusion I find, mostly about how Aleph works and what can you expect when adding it to your stack. Clojurists Together has recently announced Aleph to get Q1 funding, I think it's a good time to share my priorities and thoughts on development plans that were mentioned in the blog post. Hope the community would find it interesting and helpful.

Aleph describes itself as "asynchronous communication for Clojure" library. And you should probably pay a good portion of your attention to the first word: "asynchronous".

@mfikes
mfikes / graal-cc.md
Last active August 5, 2021 18:29
Testing perf of GraalVM version of Google Closure Compiler for ClojureScript cljs.core
git clone https://github.com/clojure/clojurescript
cd clojurescript
script/bootstrap
script/test

Ctrl-C when it logs

Applying optimizations :advanced to 344 sources
@mfikes
mfikes / README.md
Last active March 8, 2019 12:11
cljs.main rebel-readline

Start cljs.main with rebel-readline:

clojure -Sdeps '{:deps {github-mfikes/cljs-main-rebel-readline {:git/url "https://gist.github.com/mfikes/9f13a8e3766d51dcacd352ad9e7b3d1f" :sha "27b82ef4b86a70afdc1a2eea3f53ed1562575519"}}}' -i @setup.clj -m cljs.main
(ns switch
(:require [clojure.pprint :as pprint]))
(defn project-clj-map [filename]
(->> (slurp filename)
(read-string)
(drop 1)
(partition 2)
(map vec)
(into {})))
@bradwestfall
bradwestfall / S3-Static-Sites.md
Last active April 10, 2024 16:40
Use S3 and CloudFront to host Static Single Page Apps (SPAs) with HTTPs and www-redirects. Also covers deployments.

S3 Static Sites

⚠ This post is fairly old. I don't keep it up to date. Be sure to see comments where some people have posted updates

What this will cover

  • Host a static website at S3
  • Redirect www.website.com to website.com
  • Website can be an SPA (requiring all requests to return index.html)
  • Free AWS SSL certs
  • Deployment with CDN invalidation