Skip to content

Instantly share code, notes, and snippets.

@kahunamoore
kahunamoore / console.txt
Created January 15, 2014 06:33
Odd rule binding behavior
v: c ?e1: ?e2: puzzle.core.Entry@ebe1e4be
v: c ?e1: ?e2: puzzle.core.Entry@ebe1e4be
v: c ?e1: ?e2: puzzle.core.Entry@ebe1e4be
v: c ?e1: ?e2: puzzle.core.Entry@ebe1e4be
v: b ?e1: ?e2: puzzle.core.Entry@ebe1e4bf
v: a ?e1: ?e2: puzzle.core.Entry@ebe1e4bc
@kahunamoore
kahunamoore / gist:a54a8c030167c5bd669f
Created January 23, 2015 02:02
C++ Generic Initializer List
// from: http://stackoverflow.com/questions/15848781/constructor-for-nested-initializer-lists
template <int d, typename T>
class ClassA {
size_t n_[d] = {0};
T* data_;
template <int D, typename U>
struct Initializer_list {
// C++11 style observer pattern implementation using lambda for scoped
// connection management.
//
// Copyright (c) 2012 Nick C.
//
// 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
(ns om-data.core
(:require [om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]
[datascript :as d]))
(enable-console-print!)
(def schema {})
(def conn (d/create-conn schema))
(ns reagent-test.core
(:require [reagent.core :as reagent :refer [atom]]
[datascript :as d]
[cljs-uuid-utils :as uuid]))
(enable-console-print!)
(defn bind
([conn q]
(bind conn q (atom nil)))
;; Remember to (:import goog.Uri) in your ns declaration
;; Example input/output:
;; http://localhost:10555/?model=duck&manual-tick=false&collapse-all=true&capture-first-frame=true&skybox-name=sky1.png&age=30&money=300.30
;; => {:model "duck",
;; :tick-first-frame? false,
;; :manual-tick? false,
;; :collapse-all? true,
;; :capture-first-frame? true,
;; :skybox-name ["sky1" "png"],
;; :age 30,
@kahunamoore
kahunamoore / core.cljs
Last active August 29, 2015 14:24 — forked from scttnlsn/core.cljs
(ns nested-routing.core
(:require [goog.events :as events]
[goog.history.EventType :as EventType]
[reagent.core :as reagent]
[reagent.ratom :refer-macros [reaction]]
[re-frame.core :refer [dispatch dispatch-sync register-handler register-sub subscribe]]
[secretary.core :as secretary :refer-macros [defroute]])
(:import goog.History))
(declare route-components
(ns cljs-react-reload.core
(:require
[cljs.env :as env]))
(defmacro def-react-class [vname body & {:keys [redefine]}]
(let [vname-proxy# (symbol (str vname "-proxied"))]
(if (and env/*compiler*
(let [{:keys [optimizations]} (get env/*compiler* :options)]
(or (nil? optimizations) (= optimizations :none))))
`(do
@kahunamoore
kahunamoore / what-forces-layout.md
Created September 27, 2015 18:25 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@kahunamoore
kahunamoore / hope.md
Created September 30, 2016 09:00 — forked from ultimape/hope.md
Dear Internet Friend. I made this for you. It might be re-gifted, but I hope you like it anyway. #TMMTO #HOPE