Skip to content

Instantly share code, notes, and snippets.

(ns binding
(:import java.util.concurrent.Executors))
(def thread-pool
(Executors/newFixedThreadPool 1))
(set-agent-send-off-executor! thread-pool)
(def counter (agent 0))
@marcomorain
marcomorain / gist:684e5febf6235fd9b5a95cfc48aaf2a4
Created October 29, 2019 11:18
A Clojure Unit Test Has Failed
Testing circleci.vm-service.vms-test
FAIL in (provision-vm-sets-provision-result) (clojure_test.cljc:30)
Instant start and SSH successful
{:result #error {
:cause Validation failed: writeKey must not be null or empty
:via
[{:type java.lang.IllegalArgumentException
:message Validation failed: writeKey must not be null or empty
:at [io.honeycomb.libhoney.utils.Assert notEmpty Assert.java 40]}]
desc 'Renew push certifications and store them on the server'
lane :renew_certificate do
fastlane_require 'spaceship'
config = whitelabel(type: :store, download: false)
# If we are at the limit of push certificates (2), then revoke
# the oldest.
Spaceship::Portal.login
existing_certificates = Spaceship::Portal.certificate.production_push.all
.select {|c| c.owner_name == config.bundle_id }
(defn anglo [num]
(apply str
(reverse
(flatten
(interpose ","
(partition 3 3 (repeat "")
(reverse (str num))))))))
(anglo "12345678900") => "12,345,678,900"
(defn future-call [f]
;; Before we start the future grab a copy of the current stack
(let [stack (.getStackTrace (Exception.))]
(future
(try
(f)
(catch Exception e
;; An exception thrown from a future has a stack that does not
;; include the outer stack trace. We can fix this by appending
;; the stack trace we captured above into the caught exception.
@marcomorain
marcomorain / clojure.md
Last active October 17, 2018 08:55
Clojure Error Messages

Clojure 1.8

$ clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.8.0"}}}'
Clojure 1.8.0
user=>  (let [2])
IllegalArgumentException let requires an even number of forms in binding vector in user:1  clojure.core/let (core.clj:4333)

Clojure 1.9

$ clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.9.0"}}}'

@marcomorain
marcomorain / Promise.java
Created February 8, 2017 10:55
A Java Implementation of Clojure's promises
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
public class Promise<T> {
private final CountDownLatch latch = new CountDownLatch(1);
private final AtomicReference<T> value = new AtomicReference<>();
public void deliver(T value) {
Error 503 No healthy backends
No healthy backends
Guru Mediation:
Details: cache-lhr6324-LHR 1484232928 1781317846
Varnish cache server
@marcomorain
marcomorain / whitespace.tsx
Created October 11, 2016 11:11
Visual Studio Code Whitespace Typescript TSX Bug
import * as React from 'react'
var restaurantName = 'My Restaurant'
var closedAlert: JSX.Element = (
<h4>{restaurantName} is Closed</h4>
)
public class Promise<T> {
private final AtomicReference<T> ref = new AtomicReference<T>();
private final CountDownLatch latch = new CountDownLatch(1);
public final void deliver(T object) {
if (this.ref.compareAndSet(null, object)) {
latch.countDown();
}
}