Skip to content

Instantly share code, notes, and snippets.

View app.jsx
import React, { Component } from 'react';
import { Grid, ScrollSync, AutoSizer } from 'react-virtualized';
import 'react-virtualized/styles.css';
class App extends Component {
render() {
return (
<div className="App">
<div className='Table' style={{width: 600, height: 400}}>
<AutoSizer>
View gist:5251620
(walk-term [1 {1 1} [1 1 1] #{1 2 3} (l/llist 1 1 1)]
(fn [expr]
(if (number? expr)
(inc expr)
expr)))
;; => [3 {3 3} [3 3 3] #{1 2 3} (2 1 . 1)]
View gist:5137330
user=> (use 'clojure.core.logic.unifier)
user=> (prep '([?x]))
([<lvar:?x>]) ;; ok. ?x turned into an lvar
user=> (prep '([?x] . ?xs))
([?x] . <lvar:?xs>) ;; fail. ?x is not an lvar
View gist:4374467
;; Given a class name, which methods have changed the most?
(->> (q '[:find ?name (count ?sha)
:in $ ?class-name
:where
[?codeq :java/class-name ?class-name]
[?mcodeq :codeq/parent ?codeq]
[?mcodeq :java/method ?codename]
[?codename :code/name ?name]
[?mcodeq :codeq/code ?code]
[?code :code/sha ?sha]]
@jonase
jonase / codeq-examples.clj
Created Nov 20, 2012 — forked from richhickey/codeq-examples.clj
codeq examples used in conj talk
View codeq-examples.clj
(require '[datomic.api :as d])
(require '[clojure.pprint :refer [pprint]])
(def uri "datomic:free://localhost:4334/git")
(def conn (d/connect uri))
(def db (d/db conn))
;; committers
(d/q '[:find ?email
:where
[_ :commit/committer ?u]
View gist:3948008
(defmulti foo identity)
(defmethod foo 1 [n]
(recur (dec n)))
(defmethod foo 0 [n]
:ok)
(foo 1) ;; runs forever
View gist:3224348
(use '[datomic.api :only [db q] :as d])
(def schema
[{:db/doc "A persons name"
:db/id #db/id[:db.part/db]
:db/ident :name
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one
:db.install/_attribute :db.part/db}
@jonase
jonase / gist:3175654
Created Jul 25, 2012
query performance predictability
View gist:3175654
(use '[datomic.api :only [db q] :as d])
(def schema
[{:db/id #db/id[:db.part/db]
:db/ident :num
:db/valueType :db.type/long
:db/cardinality :db.cardinality/one
:db.install/_attribute :db.part/db}
{:db/id #db/id[:db.part/db]
View gist:3122363
(use '[datomic.api :only [db q] :as d])
(def schema
[{:db/doc "A persons name"
:db/id #db/id[:db.part/db]
:db/ident :name
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one
:db.install/_attribute :db.part/db}
View gist:3115120
(use '[datomic.api :only [db q] :as d])
(def schema
[{:db/doc "A persons name"
:db/id #db/id[:db.part/db]
:db/ident :name
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one
:db.install/_attribute :db.part/db}
You can’t perform that action at this time.