Skip to content

Instantly share code, notes, and snippets.

# Initially, the focus is on row 0, cell 0.
Focusing <input data-reactid=​".0.3.1.0.1.$row0.1:​$cell0.0">​
activeElement <input data-reactid=​".0.3.1.0.1.$row0.1:​$cell0.0">​
# Press Tab, and now focus moves to row 0, cell 1,
Focusing <input data-reactid=​".0.3.1.0.1.$row0.1:​$cell1.0">​
activeElement <input data-reactid=​".0.3.1.0.1.$row0.1:​$cell1.0">​
# Ask for document.activeElement in Console, and it's row 0, cell 2.
document.activeElement <input type=​"checkbox" data-reactid=​".0.3.1.0.1.$row0.2.0">​
scala> class Foo
defined class Foo
scala> val l = List(1,2,3)
l: List[Int] = List(1, 2, 3)
scala> def f(i: Int): Option[Int] = if (i % 2 == 0) Some(i) else None
f: (i: Int)Option[Int]
scala> l.map(f)
BOT FILESYSTEM SIZE USED AVAIL CAPACITY
felix-2-lion: /dev/disk0s2 465Gi 56Gi 409Gi 12%
tom-1-lion: /dev/disk0s2 465Gi 56Gi 408Gi 13%
felix-1-lion: /dev/disk0s2 465Gi 83Gi 381Gi 18%
jerry-2-lion: /dev/disk0s2 233Gi 70Gi 162Gi 31%
pinky-2-mavericks: /dev/disk0s2 233Gi 98Gi 135Gi 43%
jerry-1-lion: /dev/disk0s2 233Gi 105Gi 127Gi 46%
pinky-1-mavericks: /dev/disk0s2 233Gi 106Gi 126Gi 46%
jerry-16-yosemite: /dev/disk0s2 186Gi 77Gi 109Gi 42%
pinky-6: /dev/disk0s2 186Gi 104Gi 82Gi 56%
var gulp = require('gulp');
var ts = require('gulp-typescript');
var sources = [
'src/*.ts'
];
var typings = [
'typings/byline/byline.d.ts',
'typings/request/request.d.ts',
{
"name": "download-build-times",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
(let [workers nil]
(defn monitor-and-pyramid [src dest steps]
(if (empty? @workers)
(let [monitor (monitor-and-pyramid src dest)
pyramid (make-image-pyramid dest steps)]
(set! workers (list monitor pyramid))
(doseq [w workers] (.execute w)))
(do (doseq [w workers] (.cancel w true))
(set! workers nil)))))
(defn thumbnail-info [dir i]
(let [thumbs (.listFiles dir (with-suffix i))]
(when-not (empty? thumbs)
(let [image (IJ/openImage (.getAbsolutePath (first thumbs)))]
{:width (.getWidth image)
:height (.getHeight image)}))))
(let [workers (ref [])]
(defn monitor-and-pyramid [src dest steps]
(if (empty? @workers)
(let [monitor (monitor-directory src dest)
pyramid (make-image-pyramid dest steps)]
(dosync (doseq [w [monitor pyramid]] (.execute w))
(ref-set workers [monitor pyramid])))
(dosync (doseq [w @workers] (.cancel w true))
(println "Cancelled")
(ref-set workers [])))))
int count;
byte [] data = new byte [DATA_BLOCK_SIZE];
while ((count = input.read (data, 0, DATA_BLOCK_SIZE)) != -1) {
output.write (data, 0, count);
}
(defn write [name data]
(let [buf (make-array Byte/TYPE 1024)
dest (FileOutputStream. name)]
(with-open [r (BufferedInputStream. data)
w (BufferedOutputStream. dest)]
(loop [bytes (.read r buf 0 1024)]
(when-not (= bytes -1)
(.write w buf)
(recur (.read r buf 0 1024)))))
(println "Wrote" name)))