Skip to content

Instantly share code, notes, and snippets.

05-10 15:52:00 DEBUG metabase.query-processor ::
QUERY: 😎
{:database 2, :type "query", :query {:source_table 5, :aggregation ["count"], :breakout [["fk->" 47 216]], :filter []}, :constraints {:max-results 10000, :max-results-bare-rows 2000}}
05-10 15:52:00 DEBUG metabase.query-processor ::
PREPROCESSED/EXPANDED: 😻
{:database {:name "doh", :details "😋 ", :id 2, :engine :bigquery},
:type "query",
:query
{:source-table {:name "bookings", :id 5},
@hden
hden / core.clj
Created April 19, 2016 03:40
Datomic inventory
(ns inventory.core
(:gen-class)
(:require [datomic.api :as d]))
(def uri "datomic:mem://test")
(def schema [{:db/id #db/id[:db.part/db]
:db/ident :stock/in-stock
:db/valueType :db.type/bigint
:db/cardinality :db.cardinality/one
@hden
hden / core.cljs
Created March 30, 2016 16:21
datascript recursive pull
(ns demo.core
(:require [datascript.core :as d]))
(enable-console-print!)
(def conn (d/create-conn {:parent {:db/valueType :db.type/ref}}))
(d/transact! conn [[:db/add -1 :name "Foo"]
[:db/add -2 :name "Bar"]
[:db/add -3 :name "Baz"]
@hden
hden / app-state.json
Last active March 10, 2016 05:35
Feature Toggles
{
"experiement-namespace": "B",
"another-namespace": "A"
}
@hden
hden / LICENSE
Last active January 13, 2016 03:38
Send emails from Google SpreadSheet
The MIT License (MIT)
Copyright (c) 2016 Hao-kang Den
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@hden
hden / component.js
Created August 6, 2015 17:56
React JS Event-Emitter Mixin (you don't even have to inherent from React.Component)
import EventEmitter from 'events'
import shallowEqual from 'shallowEqual'
const shallowCompare = (instance, nextProps, nextState) => {
// https://github.com/facebook/react/blob/master/src/addons/shallowCompare.js
return (
!shallowEqual(instance.props, nextProps) ||
!shallowEqual(instance.state, nextState)
)
}
@hden
hden / turnstile.js
Created July 16, 2015 06:39
functional FSM
// turnstile.js
let lock, open
lock = (action) => {
if (action === 'coin') {
return open
} else {
return lock
}
}
@hden
hden / sinon-1.15.4.js
Created July 9, 2015 17:51
Sinon.JS 1.15.4, 2015/06/27
/**
* Sinon.JS 1.15.4, 2015/06/27
*
* @author Christian Johansen (christian@cjohansen.no)
* @author Contributors: https://github.com/cjohansen/Sinon.JS/blob/master/AUTHORS
*
* (The BSD License)
*
* Copyright (c) 2010-2014, Christian Johansen, christian@cjohansen.no
* All rights reserved.
@hden
hden / README.md
Created May 28, 2015 18:05
reactive virtual DOM with coroutine

coroutine, channel, and virtual DOM element

This pattern is heavily inspired by golang concurrency patterns

  • each component runs within an individual coroutine
  • components communicate via channels
  • runloops are blocked until message, but the main loop remains free
/** @jsx element */
@hden
hden / index.md
Created May 27, 2015 12:43
pg quote

Game

quoted from: http://www.paulgraham.com/before.html#game

We saw this happen so often that we made up a name for it: playing house. Eventually I realized why it was happening. The reason young founders go through the motions of starting a startup is because that's what they've been trained to do for their whole lives up to that point. Think about what you have to do to get into college, for example. Extracurricular activities, check. Even in college classes most of the work is as artificial as running laps.

I'm not attacking the educational system for being this way. There will always be a certain amount of fakeness in the work you do when you're being taught something, and if you measure their performance it's inevitable that people will exploit the difference to the point where much of what you're measuring is artifacts of the fakeness.

I confess I did it myself in college. I found that in a lot of classes there might only be 20 or 30 ideas that were the right shape to make good exam questions. The