Skip to content

Instantly share code, notes, and snippets.

View DogLooksGood's full-sized avatar
🥌
Debugging

tianshu DogLooksGood

🥌
Debugging
View GitHub Profile
@DogLooksGood
DogLooksGood / list_view.cljs
Last active August 14, 2019 03:28
SimpleListView
(ns demo.list-view
"A ListView provides:
1. Refresh control
2. Pagination"
(:require [reagent.core :as reagent]))
(def ^:private default-bounce-height 100)
;;; Event Handlers
@DogLooksGood
DogLooksGood / lisp-colon-quote.el
Created July 18, 2019 22:06
Auto semicolon/colon and singlequote/doublequote
(defun user/lisp-semicolon ()
"Will insert a semicolon if we are at the beginning of the line,
otherwise will insert a colon."
(interactive)
(if (or (nth 3 (syntax-ppss))
(save-mark-and-excursion
(while (equal (char-before) 59)
(backward-char))
(equal (point) (line-beginning-position))))
(call-interactively 'paredit-semicolon)
@DogLooksGood
DogLooksGood / init.el
Created October 12, 2016 17:37
My emacs config file.
;; Minimal setup for Clojure development & Org document.
(require 'package)
(setq package-enable-at-startup nil)
(setq package-archives
'(("gnu-cn" . "http://elpa.zilongshanren.com/gnu/")
("melpa-cn" . "http://elpa.zilongshanren.com/melpa/")
("melpa-stable-cn" . " http://elpa.zilongshanren.com/melpa-stable/")
("marmalade-cn" . "http://elpa.zilongshanren.com/marmalade/")
@DogLooksGood
DogLooksGood / diff_and_apply.clj
Last active April 20, 2016 14:02
Vector items diff and apply.
(require '[clojure.set :refer [difference intersection]])
(defn diff [x y k]
(let [xks (set (map k x))
yks (set (map k y))
y-map (zipmap (map k y) y)
x-map (zipmap (map k x) x)
cancel (difference xks yks)
commit-ks (difference yks xks)
commit (vec (vals (select-keys y-map commit-ks)))
@DogLooksGood
DogLooksGood / core.cljs
Last active January 8, 2016 05:57
Markdown edit demo for dynamic css reload with reagent & garden.
(ns mkd.core
(:require [reagent.core :as r :refer [atom]]
cljsjs.marked
[goog.style :as style]
[goog.dom :as dom]
[garden.core :refer [css]]
[garden.units :refer [percent px vh em]]))
(enable-console-print!)
@DogLooksGood
DogLooksGood / JsonPathHelper.java
Last active January 4, 2016 02:05
json generate helper
import org.codehaus.jettison.json.JSONObject;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
/**
* Created by DogLooksGood on 16/1/3.
*
@DogLooksGood
DogLooksGood / nvim-terminal-edit.py
Last active April 6, 2016 12:27 — forked from tarruda/nvim-terminal-edit.py
Edit file in host Neovim instance from a :terminal buffer
#!/usr/bin/env python
"""Edit a file in the host nvim instance."""
import os
import sys
from neovim import attach
args = sys.argv[1:]
if not args:
print "Usage: {} <filename> ...".format(sys.argv[0])