Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am dcao on github.
  • I am dmcao (https://keybase.io/dmcao) on keybase.
  • I have a public key ASCRXBBIKxXBcAFxtL2DnXuCPlh4wzMY_q-M5Qrt5SwdQgo

To claim this, I am signing this object:

@dcao
dcao / align.el
Last active May 9, 2017 04:05
Right align asterisks in org-mode
(require 'ov)
(defun org-max-heading-depth ()
"Get maximum depth of a heading."
(let ((max-depth 0)
depth)
(org-map-entries (lambda ()
(when (> (setq depth (car (org-heading-components))) max-depth)
(setq max-depth depth))))
max-depth))
@dcao
dcao / index.html
Created November 27, 2016 02:44
d3 animated axis scaling
<!DOCTYPE html>
<html>
<head>
<title>Interactivitity</title>
<script src="http://d3js.org/d3.v4.min.js" charset="utf-8"></script>
</head>
<body>
<p>Move the points!</p>
<script>
@dcao
dcao / Require.jl
Last active November 22, 2016 07:43
macro for python-style qualified imports
macro require(mod::Symbol, qualified::Symbol, name::Symbol) if qualified == as return :(import $mod; $(esc(:(const $name = $mod)))) end end
@dcao
dcao / README.md
Last active June 16, 2016 02:17 — forked from sathomas/README.md
Understanding D3.js Force Layout - 1: The Simplest Possible Graph

This is part of a series of examples that describe the basic operation of the D3.js force layout. Eventually they may end up in a blog post that wraps everything together.

The first example creates the simplest possible graph using a force layout. The comments in the code walk through the steps in creating a force directed graph.

Things start to get more interesting in the next example.

@dcao
dcao / .vimrc
Last active November 3, 2015 03:03
vimrc.win
" .vimrc
" See: http://vimdoc.sourceforge.net/htmldoc/options.html for details
" For multi-byte character support (CJK support, for example):
"set fileencodings=ucs-bom,utf-8,cp936,big5,euc-jp,euc-kr,gb18030,latin1
" Vim Plug
set nocompatible " Be iMproved
call plug#begin('C:\Users\David\vimfiles\plugged')
@dcao
dcao / init.el
Last active August 29, 2015 14:17
emacs init.el
;;; init.el / fedoras
;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ;; ;;
;;; ;; 1. Preamble - Load MELPA ;;
;;; ;; ;;
;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'erc)
(require 'package)
@dcao
dcao / README.md
Last active August 29, 2015 14:15 — forked from mbostock/.block
@dcao
dcao / 0_reuse_code.js
Created March 7, 2014 05:19
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console