Skip to content

Instantly share code, notes, and snippets.

Nate Hunzaker nhunzaker

Block or report user

Report or block nhunzaker

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View workbook.el
(defun nh/today-as-string ()
"Today, as a string."
(format-time-string "%y.%m.%d"))
(defun current-workbook ()
"Location of the current workbook log file."
(concat "~/.org/worklog/" (nh/today-as-string) ".org"))
(defun workbook ()
"Opens up my workbook."
View microcosm.next.md

Next Microcosm

I've had a couple of things on my mind with regard to the next version of Microcosm.

A client-side version of GraphQL

I want to be able to build out a Microcosm state tree using GraphQL. A single document would automatically produce a fast, well documented, easily configurable Microcosm setup. For example:

type Author {
@nhunzaker
nhunzaker / react-dom.cjs.js
Last active Aug 16, 2017
Current as of 7e297e9b20d75ee9cc39aadf7e83133af1869881
View react-dom.cjs.js
/*
Modernizr 3.0.0pre (Custom Build) | MIT
*/
var aa = require("react"),
ba = require("fbjs/lib/invariant"),
l = require("fbjs/lib/ExecutionEnvironment"),
n = require("object-assign"),
ca = require("fbjs/lib/EventListener"),
w = require("fbjs/lib/emptyFunction"),
da = require("fbjs/lib/emptyObject"),
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Untitled benchmark</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
View html-props.md

Number

  • cellPadding
  • cellSpacing
  • colSpan
  • coords
  • height
  • high
  • low
  • marginHeight
View html-props.md

Number

  • cellPadding
  • cellSpacing
  • colSpan
  • coords
  • height
  • high
  • low
  • marginHeight
View example.test.js
describe('Jest Electron Runner', function() {
it('has access to the window', function() {
expect(window).toEqual(global)
})
it('has access to the document', function() {
expect(document).toEqual(global.document)
})
@nhunzaker
nhunzaker / index.html
Created Dec 10, 2016
Object.create vs shallow clone #jsbench #jsperf (http://jsbench.github.io/#ab0f9152b4a3df689cbfe98062adf36e) #jsbench #jsperf
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Object.create vs shallow clone #jsbench #jsperf</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
View bubble.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Delegation</title>
</head>
<body>
<div id="container">Loading...</div>
<script src="../../lib/react.js"></script>
@nhunzaker
nhunzaker / 0.readme.md
Last active Sep 2, 2016
Profiler comparison for only attaching local click listeners in React to non-interactive elements
View 0.readme.md

I noticed that React adds a local click handler on buttons. That got me curious, so I dug in and noticed that there's a fix for click event bubbling in iOS. iOS doesn't allow click bubbling for non-interactive elements, so a workaround is made by adding a local listener (http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html).

This does make things a little faster, using https://github.com/krausest/js-framework-benchmark, rendering 10k rows, Transaction.closeAll runs about twice as fast (because a bunch of click handler attachments go away).

Before:

A dummy listener gets added to all of the buttons:

screen shot 2016-09-02 at 9 29 41 am

You can’t perform that action at this time.