Skip to content

Instantly share code, notes, and snippets.

@mudphone
mudphone / piperighterror.ex
Created September 9, 2015 11:11
Error when I use |>> instead of ~>>
== Compilation error on file lib/common_macros.ex ==
** (SyntaxError) lib/common_macros.ex:3: syntax error before: '>'
(elixir) lib/kernel/parallel_compiler.ex:95: anonymous fn/4 in Kernel.ParallelCompiler.spawn_compilers/8
** (exit) shutdown: 1
(elixir) lib/kernel/parallel_compiler.ex:199: Kernel.ParallelCompiler.handle_failure/5
(elixir) lib/kernel/parallel_compiler.ex:182: Kernel.ParallelCompiler.wait_for_messages/8
(elixir) lib/kernel/parallel_compiler.ex:55: Kernel.ParallelCompiler.spawn_compilers/3
(iex) lib/iex/helpers.ex:94: IEx.Helpers.c/2
;;=> (var 0)
;;Traceback (most recent call last):
;; File "<input>", line 1, in <module>
;; File "<input>", line 4, in __init__
;;TypeError: object.__init__() takes no parameters
(defclass var [PSet]
[]
(defn --init-- [self c]
(.--init-- (super) self [c]))
@mudphone
mudphone / logic.hy
Last active November 14, 2015 22:01
(import [user-mu [*]])
(require user-mu)
;; Mostly translated from Scheme examples in "The Reasoned Schemer,"
;; by Daniel P. Friedman, William E. Byrd, and Oleg Kiselyov.
(defn caro [p a]
(fresh [d]
(== (cons a d) p)))
@mudphone
mudphone / figwheel.clj
Last active November 28, 2015 22:00
Om-Tutorial with Figwheel in Emacs with CIDER
;; In script/figwheel.clj
;; Can be run from project root:
;; $ rlwrap lein run -m clojure.main script/figwheel.clj
;;
;; Or, from a CLJS file buffer:
;; M-x cider-jack-in
;; then eval these forms:
;; M-x cider-eval-buffer
(require
'[figwheel-sidecar.repl :as r]
defmodule Demo.Mixfile do
use Mix.Project
def project do
[app: :demo,
version: "0.0.1",
elixir: "~> 1.3",
elixirc_paths: elixirc_paths(Mix.env),
compilers: [:phoenix, :gettext] ++ Mix.compilers,
build_embedded: Mix.env == :prod,
@mudphone
mudphone / Six.hs
Created July 25, 2016 03:15
Typeclass instances
module Six where
data TisAnInteger =
TisAn Integer
instance Eq TisAnInteger where
(==) (TisAn x) (TisAn x') =
x == x'
data TwoIntegers =
@mudphone
mudphone / DockerThings.md
Last active August 22, 2016 02:49
Docker Things

From Docker in Practice, by IAan Miell, Aidan Hobson Sayers

ping each running container

docker ps -q | xargs docker inspect --format='{{.NetworkSettings.IPAddress}}' | xargs -l1 ping -c1

use host's bash history

function basher() {
@mudphone
mudphone / fn.swift
Last active December 2, 2016 01:49
public class Presence {
func adder(a: Int, b: Int) -> Int {
return a + b
}
func anotherAdder(addy: (Int, Int) -> Int = adder) -> Int {
return addy(4, 5) + 6
}
}
@mudphone
mudphone / init.el
Created July 26, 2017 22:25
A sample init.el
(require 'package)
(setq package-archives
'(("marmalade" . "http://marmalade-repo.org/packages/")
("melpa" . "http://melpa.milkbox.net/packages/")
("melpa-stable" . "http://stable.melpa.org/packages/")
("gnu" . "http://elpa.gnu.org/packages/")
))
;; ("org" . "http://orgmode.org/elpa/")
(setq package-pinned-packages
(set-env!
:source-paths #{"src"}
:dependencies '[])
(require '[boot.core :as c]
'[clojure.java.io :as io])
(deftask my-count