Skip to content

Instantly share code, notes, and snippets.

View Em-AK's full-sized avatar

Emilien Em-AK

  • Le Perche, France
View GitHub Profile
@roman01la
roman01la / clojurescript-repl-workflow.md
Last active October 22, 2022 12:07
ClojureScript REPL Workflow

ClojureScript REPL Workflow

Short write up on using REPL when developing UIs in ClojureScript.

Hot-reload on save or Eval in REPL?

Everyone's standard approach to hot-reloading is to use a tool (Figwheel or shadow-cljs) that reloads changed namespaces automatically. This works really well: you change the code, the tool picks up changed files, compiles namespaces and dependants, notifies REPL client which then pulls in compiled changes, and re-runs a function that re-renders UI.

The other approach is to use ClojureScript's REPL directly and rely only on eval from the editor. This more or less matches Clojure style workflow. This approach might be useful when you don't want tools overhead or hot-reloading becomes slow for you or you just used to this style of interactions. Also changing code doesn't always mean that you want to reload all the changes. On the other hand it is very easy to change a couple of top-level forms and forget to eval one of them.

@yogthos
yogthos / clojure-beginner.md
Last active November 7, 2024 21:09
Clojure beginner resources

Introductory resources

@jmlsf
jmlsf / js-in-cljs.md
Last active January 25, 2024 23:15
Using JavaScript modules in ClojureScript

Using JavaScript Libraries from ClojureScript

Using JavaScript libraries from ClojureScript involves two distinct concerns:

  1. Packaging the code and delivering it to the browser
  2. Making ClojureScript code that accesses JavaScript libraries safe for advanced optimization

Right now, the only single tool that solves these probems reliably, optimally, and with minimal configuration is shadow-cljs, and so that is what I favor. In paricular, shadow-cljs lets you install npm modules using npm or yarn and uses the resulting package.json to bundle external dependencies. Below I describe why, what alternatives there are, and what solutions I disfavor at this time.

Packaging and Delivering Code

@roman01la
roman01la / core.clj
Created February 4, 2018 16:46
Parsing with clojure.spec
(require '[clojure.spec.alpha :as s])
[:h1 {} "0" 1 [:span]]
(s/def :hiccup/form
(s/or
:string string?
:number number?
:element :hiccup/element))
@FredrikAugust
FredrikAugust / wallpaper.sh
Created February 27, 2017 22:17
Set a random wallpaper from unsplash with 1920x1080 resolution
#!/bin/bash
wget https://source.unsplash.com/random/1920x1080 -O ~/.wallpaper.jpg
feh --bg-fill ~/.wallpaper.jpg
@pesterhazy
pesterhazy / reagent-ref-functions.clj
Last active January 19, 2023 11:31
Using ref functions with reagent
;; React supports "refs" as a way for a component to get a
;; handle to its children. Classically, refs were string-based.
;; Recent versions of React support callback attributes as a
;; more elegant variant of accessing DOM notes or components.
;;
;; This example uses a Form-3 component as per
;; https://github.com/Day8/re-frame/wiki/Creating-Reagent-Components
;;
;; For callback refs, see React's documentation
;; https://facebook.github.io/react/docs/more-about-refs.html
@alibo
alibo / iran-sanctions_blocker-sites.csv
Last active May 11, 2024 06:28
List of sites which block IPs come from Iran [UPDATING... (July 16, 2020)] #SANCTIONS
Title URI
Flurry by Yahoo https://dev.flurry.com/secure/signup.do
Google NikCollection https://dl.google.com/edgedl/photos/nikcollection-full-1.2.11.dmg
Bitbucket http://bitbucket.org/
SoftLayer http://softlayer.com/
VirtualBox http://download.virtualbox.org/virtualbox/5.0.16/VirtualBox-5.0.16-105871-OSX.dmg
Docker Hub https://hub.docker.com/
Oracle http://oracle.com/
Java http://java.com
Sun http://sun.com
@anikalindtner
anikalindtner / gist:9524950
Last active March 1, 2023 11:52
Workshops/Mailinglists/Lists
@mika
mika / rubygem_mirror.sh
Last active December 18, 2018 05:42
generate a (partial) rubygems mirror
## Purpose: create a partial Rubygems mirror on Debian (7 AKA wheezy)
## Design goal: no system wide gems other than Debian packages
# make sure bundler, ruby-builder (required for generate_index) + rubygems-integration (required for gem<->builder integration) are available:
% sudo apt-get install ruby-bundler ruby-builder rubygems-integration
# We use gem-mirror (http://rubygems.org/gems/gem-mirror / https://github.com/YorickPeterse/gem-mirror), so
# install gem-mirror gem itself (requires ruby >=1.9) in local directory for execution via bundler:
% cat Gemfile
source 'https://rubygems.org/'
@plentz
plentz / nginx.conf
Last active November 14, 2024 08:35
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048