This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution: | |
def __init__(self): | |
self.memoized = {} | |
self.call_count = 0 | |
def areaPoints(self, point1, point2): | |
self.call_count += 1 | |
i1, j1 = point1 | |
i2, j2 = point2 | |
offsets = [(r, c) for r in range(1 + i2 - i1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset='utf-8'> | |
<link rel="stylesheet" | |
type="text/css" | |
href="https://storage.googleapis.com/app.klipse.tech/css/codemirror.css"> | |
</head> | |
<pre> | |
<code class="language-klipse"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bb | |
;; --- CONSTANTS -- | |
(def projects-directory "/home/samedhi/") | |
(def commit-to-video-config-filename ".commit-to-video.edn") | |
;; -- FILESYSTEM -- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(deftype FinalizingBuffer [buf n opts] | |
cljs.core.async.impl.protocols/Buffer | |
(full? [this] | |
(== (.-length buf) n)) | |
(remove! [this] | |
(.pop buf)) | |
(add!* [this itm] | |
(.unbounded-unshift buf itm) | |
this) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns io.github.samedhi.push | |
(:require | |
[clojure.string :as string] | |
[planck.shell :as shell])) | |
(def input-blog "/Users/stephencagle/blog") | |
(def output-blog "/Users/stephencagle/samedhi.github.io/") | |
(def now (:out (shell/sh "date" "-u" "+%FT%T%z"))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(re-frame/reg-event-fx | |
:download-file | |
(fn-traced | |
[db [_ document-id filename]] | |
(let [{:keys [active-project-id]} db | |
uri (endpoint db "projects" "ddd5f5ae1a2b4c839b1665997b9a3628" "documents" document-id)] | |
{:http-xhrio {:method :get | |
:uri uri | |
:headers (auth-header db) | |
:response-format (ajax/text-response-format) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LRUCache: | |
def __init__(self, capacity): | |
""" | |
:type capacity: int | |
""" | |
assert(capacity >= 1) | |
self.d = {} | |
self.first_node = self.last_node = current_node = {} | |
for i in range(capacity-1): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns example.test-utils | |
(:require | |
[clojure.spec.test.alpha :as spec.test] | |
[cljs.test :as test :include-macros true])) | |
(defmacro deftest-fdef [sym] | |
`(test/deftest ~(-> sym name (str "-test") symbol) | |
(let [[res#] (spec.test/check (quote ~sym)) | |
{{result# :result :as ret#} :clojure.spec.test.check/ret} res#] | |
(-> ret# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns example.silly | |
(:require | |
[clojure.spec.alpha :as spec])) | |
(spec/def ::integer int?) | |
(defn adder [a b] | |
(+ a b)) | |
(spec/fdef adder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; test-utils.cljc | |
(ns inferno.test-utils | |
(:require | |
[clojure.spec.test.alpha :as spec.test] | |
#?(:clj [clojure.test :as test] | |
:cljs [cljs.test :as test :include-macros true]))) | |
(defmacro deftest-fdef [sym] | |
`(test/deftest ~(-> sym name (str "-test") symbol) | |
(let [[res#] (spec.test/check (quote ~sym)) |
NewerOlder