Skip to content

Instantly share code, notes, and snippets.

(ns workflows-conductor.le-workspace-join
(:require [clojure.set :refer [difference
intersection
union]]))
(defn inner-join
[left-keys right-keys]
(intersection (set left-keys) (set right-keys)))
(defn outer-join
@lewang
lewang / transducers.clj
Last active August 2, 2017 13:24 — forked from ptaoussanis/transducers.clj
Quick recap/commentary: Clojure transducers
(comment ; Fun with transducers, v2
;; Still haven't found a brief + approachable overview of Clojure 1.7's new
;; transducers in the particular way I would have preferred myself - so here goes:
;;;; Definitions
;; Looking at the `reduce` docstring, we can define a 'reducing-fn' as:
(fn reducing-fn ([]) ([accumulation next-input])) -> new-accumulation
;; (The `[]` arity is actually optional; it's only used when calling
;; `reduce` w/o an init-accumulator).
@lewang
lewang / README.md
Last active October 13, 2015 15:07 — forked from mbostock/.block
Exit, Update, Enter II
@lewang
lewang / README.md
Last active September 18, 2015 16:12 — forked from mbostock/.block
General Update Pattern, III

By adding transitions, we can more easily follow the elements as they are entered, updated and exited. Separate transitions are defined for each of the three states.

Note that no transition is applied to the merged enter + update selection; this is because it would supersede the transition already scheduled on entering and updating elements. It's possible to schedule concurrent elements by using transition.transition or by setting transition.id, but it's simpler here to only transition the x-position on update; for entering elements, the x-position is assigned statically.

Want to read more? Try these tutorials:

@lewang
lewang / README.md
Last active September 16, 2015 03:00 — forked from mbostock/.block
Grouped Bar Chart

This grouped bar chart is constructed from a CSV file storing the populations of different states by age group. The chart employs conventional margins and a number of D3 features:

@lewang
lewang / README.md
Last active September 15, 2015 23:36 — forked from mbostock/.block
Bar Chart
@lewang
lewang / dualbar.js
Last active September 15, 2015 23:02 — forked from maaquib/index.html
D3JS Bar Graph (Above and Below x-axis with animation)
window.onload=function(){
var data = [-15, 20, -22, 18, -2, 6, -26, 18],
duration = 300;
var margin = {top: 30, right: 10, bottom: 10, left: 30},
width = 320 - margin.left - margin.right,
height = 250 - margin.top - margin.bottom;
var y0 = Math.max(Math.abs(d3.min(data)), Math.abs(d3.max(data)));
var y = d3.scale.linear()
<header>header</header>
<nav>navigation</nav>
<article>article</article>
<footer>footer</footer>
@lewang
lewang / wkhtmltopdf.rb
Created August 21, 2012 09:56 — forked from 2bits/wkhtmltopdf.rb
wkhtmltopdf - build formula for Homebrew supporting 0.9.9, 0.11.0_rc1, and their patched Qt4
require 'formula'
class WkhtmltopdfQt < Formula
# This is the latest staging branch commit, dated 6 JAN 2012.
url 'https://qt.gitorious.org/qt/wkhtmltopdf-qt/archive-tarball/6053b687d24956d0a7eac21a015172b29cf0f451'
sha1 'c8217e7a96d5e63cb6b2334d5eefe866d06acfde'
version '6053b68'
end
class Wkhtmltopdf < Formula