Skip to content

Instantly share code, notes, and snippets.

@mfikes
mfikes / faster-jsc.md
Last active January 24, 2017 01:19
Faster JavaScriptCore

Download latest WebKit nightly and install it somewhere. (I installed it on my desktop.)

Baseline your existing perf. I'm using a master build of the Planck 2.0.0 beta.

Here, I'm counting the lines in /usr/share/dict/words, a fairly decent real-world application involving streaming I/O, detecting line endings in ClojureScript, etc.

$ planck -q
cljs.user=> (require '[planck.core :refer [-read-line with-open]] '[planck.io :as io])
nil
@Rich-Harris
Rich-Harris / please-include-a-repro.md
Last active April 29, 2024 15:08
Please include a repro

Please include a repro

You probably arrived here because of a curt message in response to an issue you filed on a repo that I contribute to. Sorry about that (particularly if you filed the issue long ago and have been waiting patiently for a response). Let me explain:

I work on a lot of different open source projects. I really do like building software that makes other people's lives easier, but it's crazy time-consuming. One of the most time-consuming parts is responding to issues. A lot of OSS maintainers will bend over backwards to try and understand your specific problem and diagnose it, to the point of setting up new test projects, fussing around with different Node versions, reading the documentation for build tools that we don't use, debugging problems in third party dependencies that appear to be involved in the problem... and so on. I've personally spent hundreds of hours of my free time doing these sorts of things to try and help people out, because I want to be a responsible maintainer and I

@redrabbit
redrabbit / absinthe_ecto_resolution_schema.ex
Last active December 1, 2023 14:29
Absinthe.Ecto.Resolution.Schema
defmodule Absinthe.Ecto.Resolution.Schema do
@moduledoc """
This module provides helper functions to resolve a GraphQL query into `Ecto.Query`.
"""
import Absinthe.Resolution.Helpers
import Ecto.Query
alias Absinthe.Resolution
alias Absinthe.Blueprint.Document.Field
;loaded from https://gist.github.com/viebel/21fd0e02d1a1d85b2e2089568f16828c
(deftype empty-type [])
(def empty ->empty-type)
(defn empty? [x] (= (type x) empty-type))
(deftype eps-type [])
(def eps ->eps-type)
(defn eps? [x] (= (type x) eps-type))
(deftype char-type [c])

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

@tjluoma
tjluoma / search-in-1password
Last active August 23, 2017 01:00
Bookmarklet to open a JavaScript prompt, pre-filled with the current domain, and then send it to 1Password for iOS 4.1
javascript:str=window.location.hostname;n=str.split(".");l=n.length;op=window.prompt('Search in 1Password',n[(l-2)]+"."+n[(l-1)]);if(op!=null){window.location='onepassword://search/'+op;}
@trek
trek / gist:4154434
Created November 27, 2012 14:18
original notes
https://twitter.com/dagda1/status/231016636847648769
https://twitter.com/garybernhardt/status/227881347346219008/
http://ianstormtaylor.com/rendering-views-in-backbonejs-isnt-always-simple/
backbone: what you'd normally use jquery plugins for, but with an inverted rendering process (js -> DOM instead of DOM -> js)
"islands of richness", jquery data callbacks main pattern.
other frameworks are building out from jQuery's central pattern of DOM selection and event callbacks.
fantastic pattern for adding behavior to documents, but we aren't writing documents.
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@jboner
jboner / latency.txt
Last active May 12, 2024 19:52
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD