Skip to content

Instantly share code, notes, and snippets.

View zkat's full-sized avatar
💭
Rusting it up

Kat Marchán zkat

💭
Rusting it up
View GitHub Profile
@zkat
zkat / index.js
Last active March 10, 2024 14:32
npx is cool
#!/usr/bin/env node
console.log('yay gist')
@zkat
zkat / withfunctions.js
Created April 27, 2017 20:55
protoduck By Name
const Show = duck.define(a => {
show (a) {},
toString () {}
})
@zkat
zkat / figgy-pudding.js
Last active February 7, 2017 08:26
Sketch of Figgy Pudding Options Processor
// Requirements:
// Unidirectional (data flows down)
// Composable (detailed definitions can be specified at a lower level)
// Declarative types and defaults
// Minimal consing
// No bubbling of side effects to parents or siblings
// Efficient
// Warn about unspecified options being read or assigned? (or make it available to run in tests?)
// opts objects readable like plain objects (maybe?)
@zkat
zkat / ohai.md
Created January 13, 2017 06:56
Director nomination for Kat Marchán

Yes hi it's me

Hi! I'm Kat, and I want to throw my hat in as one of the nominees for Individual Membership Director for the Node.js Foundation. Why? Because the Foundation needs to do more for its individual members. All of them.

Do you have a place at the table?

JavaScript is one of the fastest-growing and most popular programming languages in the world, and Node is its primary platform for backend usage. npm's own userbase is estimated to be around 4 million, and downloads number at around 1.6 billion every week. Every single npm user is also a Node.js user in some capacity.

How many of those people have their interests represented in leadership? Which groups of people have we served best? Which groups do we never hear about? Who are the contributors, really? Do we want to change that? How could we?

@zkat
zkat / protocol-extension.js
Last active September 17, 2016 09:59
Sketched out idea for extending protocols with additional protocol constraints
const Eq = protocol(['a', 'b'], {
eq: ['a', 'b'],
neq: ['a', 'b']
})
const Ord = protocol(Eq('a', 'b'), ['a', 'b'], {
gt: ['a', 'b'],
lt: ['a', 'b']
})
@zkat
zkat / genfun-protocol.js
Last active August 27, 2016 02:43
Sketched out example of protocol library built on top of genfun
var Protocol = require('genfun-protocol')
var Eq = Protocol(['a', 'b'], {
eql: ['a', 'b'],
// Extra set of [] and you can add a default implementation!
// This will dispatch only for existing instances
// (that is, it doesn't fall through to [Object, Object] in this case)
neq: [['a', 'b'], (a, b) => !Eq.eql(a, b)]
})
@zkat
zkat / iteration.js
Last active July 13, 2016 22:49
Short guide to iteration functions!
var arr = [1,2,3,4]
// Array#map is for going from array A, to array-of-same-length B, with no side-effects.
var arrPrime = arr.map(function (num) { return num + 1 })
// forEach doesn't return anything useful (just `undefined`), so we use it for "side-effects".
var otherArr = []
arr.forEach(function (num) {
if (num % 2 !== 0) {
otherArr.push(num) // this is a side-effect
@zkat
zkat / gist:441379747a61beece62c
Last active August 29, 2015 14:24
Javascript translation of writing inline caching through load-time-value and inlining.

Base code

Consider the following code, and how it can be affected by the following transformations:

function foo () {
  return {x: 5}
}
foo() === foo() // => false

Keybase proof

I hereby claim:

  • I am zkat on github.
  • I am zkat (https://keybase.io/zkat) on keybase.
  • I have a public key whose fingerprint is 3F34 D66F DA3A B6B2 4887 2174 AEB5 29C0 8A3C 7E9E

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am zkat on github.
  • I am zkat (https://keybase.io/zkat) on keybase.
  • I have a public key whose fingerprint is AADE A47E 34FE F0D4 7EB7 F1BF 6FF7 93FB BD6F E1B5

To claim this, I am signing this object: