ClojureScript [Autumn 2022 Remix]

This has been re-published on dzone

Realtime React Coding in ClojureScript

I love ClojureScript. The language, the look, the feeling when I type the code to make my React components with it, makes me stay up all night. It actually did yesterday when I try to pick up on a friend setup and get back a modern environment to do my coding. Let’s walk through the first few steps to get to a setup with a React counter in ClojureScript, all this with live code reloading from VSCode.

Clojure for DataScience a la numpy

Modrzyk, N. (2019). Clojure. In: Sakr, S., Zomaya, A.Y. (eds) Encyclopedia of Big Data Technologies. Springer, Cham. https://doi.org/10.1007/978-3-319-77525-8_302

In the Clojure world the Python’s numpy equivalent is named tablecloth, which acts as a data frame grammar wrapping tech.ml.dataset. It has much, if not all, the functions you would expect for data science associated with an impressive speed for handling data, provided you stick with the library functions. In this short section we will see how to work with tablecloth data frames, to handle data from the just out JQuants API from the land of the rising sun where sushi shines and the sky is blue.

Finding Red Circles in an Image

With the OpenCV setup done before, it is now possible to go and actually use OpenCV for something practical. This is ported to Clojure from the following post, so please refer to it for the original write up.

The goal is to highlight different intensity of red circles in a picture.

The java imports when working with OpenCV are quite consistent between examples, so let’s add them along with the namespace definition.

https://dev.to/mattferderer/what-is-csp-why--how-to-add-it-to-your-website-28df

https://content-security-policy.com/examples/nginx/ https://bobcares.com/blog/add-csp-header-nginx/ https://content-security-policy.com/ https://stackoverflow.com/questions/58652892/content-security-policy-refused-to-execute-inline-event-handler-error

 invalid number of arguments in "add_header" 

https://dev.to/mattferderer/what-is-csp-why--how-to-add-it-to-your-website-28df


add_header 'Content-Security-Policy' 'default-src self unsafe-inline *.akamai.net *.doubleclick.net; font-src self fonts.googleapis.com fonts.gstatic.com; style-src self; script-src self cdnjs.com; img-src self;'

Content-Security-Policy-Report-Only: default-src 'none'; form-action 'none'; frame-ancestors 'none';

Content-Security-Policy-Report-Only: default-src 'none'; form-action 'none'; frame-ancestors 'none'; style-src 'self';

Content-Security-Policy-Report-Only: default-src 'none'; form-action 'none'; frame-ancestors 'none'; style-src 'self'; script-src 'self'; img-src 'self';

Content-Security-Policy-Report-Only: default-src 'none'; form-action 'none'; frame-ancestors 'none'; style-src 'self'; script-src 'self' cdnjs.com; img-src 'self';


add_header Content-Security-Policy "default-src 'self' unsafe-inline *.akamai.net *.doubleclick.net; font-src 'self' fonts.googleapis.com fonts.gstatic.com; style-src 'self'; script-src 'self' cdn.jsdelivr.net cdnjs.com; img-src 'self';";

add_header Content-Security-Policy-Report-Only "default-src 'self'; font-src 'self' fonts.googleapis.com fonts.gstatic.com; style-src 'self' https://cdn.jsdelivr.net; script-src 'self' cdn.jsdelivr.net cdnjs.com; img-src 'self';";