A Bash process may be:
State | Invocation |
---|---|
Login (L) | argv[0][0] == '-' , --login |
Interactive (I) | -i , stdin is tty |
Remote (R) | stdin is "network connection" (see below) |
Classfile /home/mark/src/clj-re/target/classes/clj_re/core$simple.class | |
Last modified 13-Jun-2018; size 1119 bytes | |
MD5 checksum 7a8f0ea3a3b22a33c335acffef1eda0a | |
Compiled from "core.clj" | |
public final class clj_re.core$simple extends clojure.lang.AFunction | |
minor version: 0 | |
major version: 49 | |
flags: ACC_PUBLIC, ACC_FINAL, ACC_SUPER | |
Constant pool: | |
#1 = Utf8 clj_re/core$simple |
The issue is that the superclass gets instantiated first, and if it has an eager val that | |
calls an abstract def (or abstract lazy val, if such a thing is possible) it will capture | |
the not-yet-fully-initialized value of that val in the subclass (which is usually null). | |
scala> trait T { def f: String; val callsF = f } // *val* `callsF` calls abstract def `f` -- risky! | |
defined trait T | |
scala> object X extends T { val f = "foooo" } // `f` is implemented with a strict val -- bomb is set | |
defined object X |
object Parens { | |
def parameterless: String = "foo" | |
def emptyParens(): String = "bar" | |
def fireNukes(): String = "nukes fired" | |
def log(f: () => String): Unit = { println("fn: " + f) } | |
def log(msg: String): Unit = { println("string: " + msg) } | |
def main(args: Array[String]) { |
#!/usr/bin/python | |
# Print filenames that are duplicated at least once (by content hash) in the | |
# repo. | |
import fileinput | |
from collections import defaultdict | |
import subprocess | |
digest_to_path = defaultdict(list) | |
p = subprocess.Popen( |
#!/bin/bash | |
set -euo pipefail | |
API_KEY=$(cat ~/.lastfm_api_key) | |
LASTFM_USER="overthink" | |
LIMIT=1000 | |
getpage() { | |
local page="${1?need page number to fetch}" | |
curl -s "http://ws.audioscrobbler.com/2.0/?method=user.getlovedtracks&user=$LASTFM_USER&api_key=$API_KEY&format=json&limit=$LIMIT&page=$page" \ |
(defn- ellipses-if-long | |
"Append \"...\" to string version of x if x's length exceeds n." | |
([x] (ellipses-if-long x 50)) | |
([x n] | |
(assert (pos? n) "n must be positive") | |
(let [s (str x)] | |
(if (> (.length s) n) | |
(str (subs s 0 n) "...") | |
s)))) |
var PIXI = require('pixi.js') | |
console.log(PIXI) |
(ns foo.core | |
"Looking at ways to mock out records when testing and also using schema." | |
(:require | |
[schema.core :as s])) | |
;; approach 1 (problematic for mocks) -------------------------------------------------- | |
(s/defrecord Thing | |
[name :- s/Str | |
age :- s/Int]) |
public <A extends java/lang/Object, B extends java/lang/Object> B apply(A, scala.Function1<A, B>); | |
flags: ACC_PUBLIC | |
Code: | |
stack=3, locals=7, args_size=3 | |
0: aload_2 | |
1: aload_1 | |
2: invokeinterface #77, 2 // InterfaceMethod scala/Function1.apply:(Ljava/lang/Object;)Ljava/lang/Object; | |
7: astore_3 | |
8: aload_1 | |
9: ifnull 37 |