Skip to content

Instantly share code, notes, and snippets.

Avatar

Marc O'Morain marcomorain

View GitHub Profile
View gist:684e5febf6235fd9b5a95cfc48aaf2a4
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]}]
View Fastfile.rb
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 }
View anglo.clj
(defn anglo [num]
(apply str
(reverse
(flatten
(interpose ","
(partition 3 3 (repeat "")
(reverse (str num))))))))
(anglo "12345678900") => "12,345,678,900"
View future.clj
(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 Oct 17, 2018
Clojure Error Messages
View clojure.md

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 Feb 8, 2017
A Java Implementation of Clojure's promises
View Promise.java
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) {
View gist:4dbeb0b0301cd22c220ee8f52cd6cbe4
Error 503 No healthy backends
No healthy backends
Guru Mediation:
Details: cache-lhr6324-LHR 1484232928 1781317846
Varnish cache server
@marcomorain
marcomorain / whitespace.tsx
Created Oct 11, 2016
Visual Studio Code Whitespace Typescript TSX Bug
View whitespace.tsx
import * as React from 'react'
var restaurantName = 'My Restaurant'
var closedAlert: JSX.Element = (
<h4>{restaurantName} is Closed</h4>
)
View Promise.java
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();
}
}
View capture.kt
fun <T> Capture(block: () -> T): T {
try {
return block.invoke()
} catch (e: Exception) {
Sentry.captureException(e)
throw e
}
}
Capture {