Skip to content

Instantly share code, notes, and snippets.

View claudiuapetrei's full-sized avatar

Claudiu Apetrei claudiuapetrei

View GitHub Profile

Code Splitting

NOTE: This gist uses the master branch of ClojureScript. Clone ClojureScript and from the checkout run ./script/bootstrap and ./script/uberjar. This will produce target/cljs.jar which you can use to follow this guide.

As client applications become larger it becomes desirable to load only the code actually required to run a particular logical screen. Previously ClojureScript :modules compiler option permitted such code splitting, but this feature only worked under :advanced compilation and users would still have to manage loading these splits. :modules also required manual

(ns app.graphql
(:require [om.next :as om]
[clojure.string :as str]
[clojure.set :as set]))
(defn graphql-type [v]
(cond
(string? v) "String"
(int? v) "Int"
(float? v) "Float"
@yogthos
yogthos / gallery.cljs
Last active March 30, 2024 17:36
script to download walpapers from windowsonearth.org
@cjbarre
cjbarre / twitter_signed_multi_part_post_request_example.clj
Last active December 14, 2019 13:49
Example: Send A Signed Multi-Part Media HTTP POST Request With Clojure | Clojure, Twitter API, media/upload, OAuth 1.0, multipart/form-data, Authorization, Signed Request
;; Example: Send A Signed Multi-Part Media HTTP POST Request With Clojure
;;
;; Keywords: Clojure, Twitter API, media/upload, OAuth 1.0, multipart/form-data, Authorization, Signed Request
;;
;; Dependencies: [clj-http "2.2.0"] [clj-oauth "1.5.5"]
;;
;; Description:
;; The code is meant to read well as an example, not be idiomatic or efficiently organized.
;;
;; I am leaving the raw materials here, put it together how you'd like it!
@pesterhazy
pesterhazy / select.cljs
Last active December 10, 2022 03:17
Using react-select with reagent
;; in your project definition
;; [cljsjs/react-select "1.0.0-rc.1" :exclusions [cljsjs/react]]
;; See react-select documentation: https://github.com/JedWatson/react-select
(ns example.select
(:require [reagent.core :as r]
[cljsjs.react-select]))
(defn select
@fd0
fd0 / gist:6951577
Created October 12, 2013 15:54
i3 multi monitor config snippet
# assign workspaces to screens
workspace 1 output DVI-I-1
workspace 2 output DVI-I-1
workspace 3 output DVI-I-1
workspace 4 output DVI-I-1
workspace 5 output DVI-I-1
workspace 6 output HDMI-0
workspace 7 output HDMI-0
workspace 8 output HDMI-0
workspace 9 output HDMI-0