Skip to content

Instantly share code, notes, and snippets.

🦄

Enzzo souenzzo

🦄
Block or report user

Report or block souenzzo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@borkdude
borkdude / js_parser.clj
Last active Sep 7, 2019
Parse JavaScript in Clojure using the Google Closure Compiler
View js_parser.clj
#!/bin/sh
#_(
"exec" "clojure" "-Sdeps" "{:deps {org.clojure/clojurescript {:mvn/version \"1.10.520\"}}}" "$0" "$@"
)
;; running js_parser.clj "function foo(x) { var y = x + 1; }" will print:
;; [{:type :function, :name "foo", :body [{:variable-statement [{:lvalue "y", :initializer {:type :binary-op, :left "x", :operator "+", :right "1"}}]}], :params ["x"]}]
View error
Error building classpath. Failed to read artifact descriptor for com.datomic:ion:jar:0.9.28
org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for com.datomic:ion:jar:0.9.28
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:276)
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:192)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.readArtifactDescriptor(DefaultRepositorySystem.java:253)
at clojure.tools.deps.alpha.extensions.maven$eval685$fn__687.invoke(maven.clj:82)
at clojure.lang.MultiFn.invoke(MultiFn.java:243)
at clojure.tools.deps.alpha$expand_deps.invokeStatic(alpha.clj:183)
at clojure.tools.deps.alpha$expand_deps.invoke(alpha.clj:165)
at clojure.tools.deps.alpha$resolve_deps.invokeStatic(alpha.clj:228)
@kennyjwilli
kennyjwilli / README.md
Last active Nov 9, 2018
Delete leftover Datomic resources
View README.md

Delete Leftover Datomic Cloud Resources

If you delete a Datomic Cloud system, it will leave some resources in AWS. To entirely delete all resources created by Datomic Cloud, you must follow these steps. Because we love automation, this script performs all these steps for you so you don't need to navigate the AWS Console UI.

Prerequisites

@gfredericks
gfredericks / frobnicate.clj
Last active Mar 1, 2019
Self-contained clojure file with deps
View frobnicate.clj
#!/usr/bin/env bash
#! top-of-file comments can be written using more #! lines, which
#! is a valid comment in both clojure and bash
":";# alternately this works too
#! The construction below uses cross-language syntactic hackery to
#! specify the -Sdeps arg in a part of the file that's interpreted
#! by clojure as clojure syntax (i.e., not a line comment), so it
@mfikes
mfikes / graal-cc.md
Last active Mar 6, 2019
Testing perf of GraalVM version of Google Closure Compiler for ClojureScript cljs.core
View graal-cc.md
git clone https://github.com/clojure/clojurescript
cd clojurescript
script/bootstrap
script/test

Ctrl-C when it logs

Applying optimizations :advanced to 344 sources
@mhuebert
mhuebert / Readme.md
Last active Oct 2, 2019
material-ui's CSS-in-JS with Reagent. (see https://material-ui.com/customization/css-in-js/)
View Readme.md

material-ui allows for customizing CSS via a higher-order component called withStyles. Like many higher-order components which expect render props, the purpose of withStyles is to accept some parameters, and then introduce a new variable into the scope of the component tree.

One succinct and simple way to translate the concept of scope into Clojure is via a custom let macro. Usage of such a macro is demonstrated here:

(:require [material-ui.styles :as m])

(m/let [{:keys [leftPad]} {:leftPad 
                           {:paddingLeft 8}}]
  ;; `leftPad` is now the _className_ associated with {:paddingLeft 8}                             
@athos
athos / deps.edn
Last active Oct 17, 2019
Try `clojure -Sdeps '{:deps {hello-clojure {:git/url "https://gist.github.com/athos/b68b15b08efedffaf14d8c020b125202" :sha "1c9a05106171f97f9b8e8ac8f58c7bd8dbe021f9"}}}' -m hello-clojure` on your terminal
View deps.edn
{:paths ["."]
:deps {clansi {:mvn/version "1.0.0"}}}
@iperdomo
iperdomo / maps.cljs
Last active Jan 11, 2018
Google Maps delete vertex sample in ClojureScript
View maps.cljs
;; https://developers.google.com/maps/documentation/javascript/examples/delete-vertex-menu
;; New implementaion based on comments by Andre Rauh (@rauh) in #clojurescript on clojurians.slack.com
;;
(defn delete-vertex-menu
[label]
(this-as this
@gdeer81
gdeer81 / spec-coercion.clj
Last active Jan 23, 2017 — forked from Deraen/spec-coercion.clj
Clojure.spec coercion test
View spec-coercion.clj
(ns spec-test.core
(:require [clojure.spec :as s]))
(defn x-integer? [x]
(if (integer? x)
x
(if (string? x)
(try
(Integer/parseInt x)
(catch Exception e
@halgari
halgari / gist:f431b2d1094e4ec1e933969969489854
Last active Aug 29, 2019
What I want from a Type System
View gist:f431b2d1094e4ec1e933969969489854
The question was asked why I (as a programmer who prefers dynamic languages) don't consider static types "worth it". Here
is a short list of what I would need from a type system for it to be truely useful to me:
1) Full type inference. I would really prefer to be able to write:
(defn concat-names [person]
(assoc person :full-name (str (:first-name person)
(:second-name person))))
And have the compiler know that whatever type required and produced from this function was acceptible as long as the
You can’t perform that action at this time.