Skip to content

Instantly share code, notes, and snippets.

💭
Rusting it up

Kat Marchán zkat

💭
Rusting it up
Block or report user

Report or block zkat

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
@zkat
zkat / ABNF
Last active Mar 21, 2018
pattern matching sketch
View ABNF
// match ABNF
Match := 'match' '(' RHSExpr ')' '{' MatchClause* '}'
MatchClause := MatchClauseLHS '=>' FatArroyRHS MaybeASI
MatchClauseLHS := [MatcherExpr] (LiteralMatcher | ArrayMatcher | ObjectMatcher | JSVar)
MatcherExpr := LHSExpr
LiteralMatcher := LitRegExp | LitString | LitNumber
ArrayMatcher := '[' MatchClauseLHS [',', MatchClauseLHS]* ']' // and... whatever it takes to shove ...splat in there
ObjectMatcher := '{' (JSVar [':' MatchClauseLHS]) [',' (JSVar [':', MatchClauseLHS])]* '}' // see above note about ...splat
@zkat
zkat / index.js
Last active Dec 16, 2017
find the cached version that's closest to a given spec
View index.js
'use strict'
const BB = require('bluebird')
const cacache = require('cacache')
const npa = require('npm-package-arg')
const pickManifest = require('npm-pick-manifest')
const ssri = require('ssri')
module.exports = cachedVersions
@zkat
zkat / README.md
Created Jun 29, 2017
real-world vue app
View README.md

This is a useful package.json from an actual user, as opposed to an artificial/fabricated app. It should be fairly representative of the sort of things users do.

@zkat
zkat / index.js
Created Jun 29, 2017 — forked from junosuarez/index.js
async cli app boilerplate
View index.js
#!/usr/bin/env node
if (process.mainModule === module) setImmediate(() => main(process.argv).catch(e => console.log(e.stack) && process.exit(1)))
async function main(argv) {
console.log(argv.slice(2))
}
@zkat
zkat / index.js
Last active Sep 10, 2019
npx is cool
View index.js
#!/usr/bin/env node
console.log('yay gist')
@zkat
zkat / withfunctions.js
Created Apr 27, 2017
protoduck By Name
View withfunctions.js
const Show = duck.define(a => {
show (a) {},
toString () {}
})
@zkat
zkat / figgy-pudding.js
Last active Feb 7, 2017
Sketch of Figgy Pudding Options Processor
View figgy-pudding.js
// 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 Jan 13, 2017
Director nomination for Kat Marchán
View ohai.md

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 Sep 17, 2016
Sketched out idea for extending protocols with additional protocol constraints
View protocol-extension.js
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 Aug 27, 2016
Sketched out example of protocol library built on top of genfun
View genfun-protocol.js
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)]
})
You can’t perform that action at this time.