Skip to content

Instantly share code, notes, and snippets.

View dotemacs's full-sized avatar

Александар Симић dotemacs

View GitHub Profile
@matthewdowney
matthewdowney / web3.clj
Created August 28, 2021 00:18
Call a smart contract from Clojure to query data from the Ethereum blockchain.
(ns web3
"Call an Ethereum smart contract (Uniswap v2) from Clojure.
Requires https://github.com/clj-python/libpython-clj for python interop. Also
make sure to $ pip install web3."
(:require [libpython-clj2.python :as py]
[libpython-clj2.require :refer [require-python]]))
(comment ;; deps.edn
@laurio
laurio / reorder.clj
Created April 5, 2021 08:42
babashka script for reordering requires and imports in clojure files
#!/usr/bin/env bb
(ns reorder
(:require [clojure.java.io :as io]
[clojure.string :as string]
[rewrite-clj.node :as n]
[rewrite-clj.zip :as z]
[rewrite-clj.zip.subedit :as zsub])
(:import (java.io File StringWriter)))
(defn- top? [loc]
@roman01la
roman01la / re-frame.clj
Last active October 21, 2020 11:32
Debugging re-frame subscriptions
(ns utils.re-frame
(:require [cljs.compiler :as cljsc]))
(defn- anonymous-function-declaration? [form]
(and (list? form)
(= 'fn (first form))
(vector? (second form))))
(defn- query-id->js-fn-name [query-id]
(let [ns-part (when-let [ns-part (namespace query-id)]
@ribasco
ribasco / how-to-install-java-on-raspbian.md
Last active March 27, 2021 18:37
How to install the latest java version in Raspbian (Stretch)

Introduction

The default version of java provided in the latest raspbian images are outdated, so we are going to install from the ppa:webupd8team/java repository instead. Please note that add-apt-repository ppa:webupd8team/java will not work, so we will need to add the repository manually.

Installation

  1. Create the gpg key file and paste the following lines of text below
nano key.txt
@pesterhazy
pesterhazy / promises-passing-values.cljs
Last active October 24, 2021 00:55
Promise chains in ClojureScript and the problem of previous values
(ns my.promises
"Demo to show different approaches to handling promise chains in ClojureScript
In particular, this file investigates how to pass data between Promise
callbacks in a chain.
See Axel Rauschmayer's post
http://2ality.com/2017/08/promise-callback-data-flow.html for a problem
statement.
@reborg
reborg / rich-already-answered-that.md
Last active July 11, 2024 09:54
A curated collection of answers that Rich gave throughout the history of Clojure

Rich Already Answered That!

A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats.

How to use:

  • The link in the table of content jumps at the copy of the answer on this page.
  • The link on the answer itself points back at the original post.

Table of Content

@john2x
john2x / 00_destructuring.md
Last active July 9, 2024 01:38
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors and Sequences

@mtnygard
mtnygard / gist:7555463
Last active May 22, 2017 10:59
The limitations of test

From Out of the Tar Pit:

The key problem with testing is that a test (of any kind) that uses one particular set of inputs tells you nothing at all about the behaviour of the system or component when it is given a different set of inputs. The huge number of different possible inputs usually rules out the possibility of testing them all, hence the unavoidable concern with testing will always be — have you performed the right tests?. The only certain answer you will ever get to this question is an answer in the negative — when the system breaks.

This is a strong argument for some form of generative, simulation, or property-based testing.

@josevalim
josevalim / exp.md
Created June 18, 2012 11:05
Possibly faster spec runs

This is an experiment for possible faster boot time (and consequently faster feedback) when running tests. I ask your help to try this in your apps (any Rails 3.x app) and let me know how well it works.

How to

Add the following lines inside the configuration block in config/environments/test.rb:

config.cache_classes = true
def eager_load!; end

Hi [your name here], thanks for getting in contact with me.

I sincerely appreciate the interest in [your company name here] hiring me, however there is several problems with this:

  1. I have just signed a lease on a new property in Melbourne. The lease is for one year. This means that I am effectively tied to Melbourne for one year.
  2. I have only recently (November) started a job for Spree Commerce. I like/love this job and would like to stay there.
  3. I have no formal qualifications past a certificate IV in Network Administration. I think qualifications are bullshit. Getting me into America would prove very difficult for your company. I am, of course, assuming you would want me on-site. Although I've written a book on the framework that I'd be hired to do work with, I doubt that would assist the process any. See #1 also for a very valid reason why this would not be possible.

I think that you would have more of an effect just by getting to know one person really well than getting to know one hundred peopl