Skip to content

Instantly share code, notes, and snippets.

Avatar
🤔
Trying to stay in the right branch of the wave function.

Jon Schlinkert jonschlinkert

🤔
Trying to stay in the right branch of the wave function.
View GitHub Profile
@jonschlinkert
jonschlinkert / benchmarks-starter.js
Last active Aug 19, 2018
Minimal code to create a benchmarks with terminal styling to show real-time progress while benchmarks are running.
View benchmarks-starter.js
const { Suite } = require('benchmark');
const argv = require('minimist')(process.argv.slice(2));
const cycle = (e, newline) => {
process.stdout.write('\u001b[G');
process.stdout.write(` ${e.target}` + (newline ? '\n' : ''));
};
function bench(name) {
const suite = new Suite()
@jonschlinkert
jonschlinkert / longest.js
Created Jun 13, 2018
Get the length of the longest item in an array of strings.
View longest.js
const longest = arr => arr.reduce((len, v) => Math.max(v.length, len), 0);
View assemble-next.js
(async function() {
const handlebars = require('handlebars');
const engine = require('./examples/support/engine');
const Assemble = require('./');
const app = new Assemble();
app.engine('hbs', engine(handlebars));
const pages = app.create('pages');
const layouts = app.create('layouts', { kind: 'layout' });
View collection-loader.js
const fs = require('fs');
const path = require('path');
const Collection = require('../lib/collection');
const collection = new Collection();
collection.use(loader());
const filter = file => file.extname === '.txt';
const contents = file => fs.readFileSync(file.path);
View public-reddit-usernames.js
module.exports = [
'014a',
'0x706272',
'13steinj',
'2bdb2',
'_3442',
'__crackers__',
'_selfishPersonReborn',
'a_redditor',
'Aceeri',
@jonschlinkert
jonschlinkert / grant-npm-owner.sh
Created Mar 7, 2018
From a script in the babel-plugin-syntax-dynamic-import library
View grant-npm-owner.sh
#!/bin/sh
set -e
read -p "Username: " username
for f in packages/*; do
package=`basename $f`
if [ -d "$f" ]; then
npm owner add $username $package
View contact.json
{
"name": "Jon Schlinkert",
"email": "jon.schlinkert@sellside.com",
"github": "jonschlinkert",
"linkedin": "jonschlinkert",
"twitter": "jonschlinkert",
"npm": "jonschlinkert"
}
@jonschlinkert
jonschlinkert / fixture.txt
Created Feb 11, 2018
This is a test fixture for the gists library, do not delete.
View fixture.txt
Do not delete.
View excerpt-from-code-ranking-paper.md

(This is an excerpt from a much longer paper I'm writing about code quality and maintaining FOSS projects.)

FOSS dependency scoring

In an effort to improve the quality of search results on sites like https://npmjs.com, there has been more and more discussion about factoring in the ranking/scoring of dependencies to influence search results. The general idea is that a library should be ranked not only on its own merits, but dependencies should weigh into the score as well.

I’m not sure what my opinion is on this yet. I was initially in favor of this, and still might be, but this document is a summary of some things that crossed my mind about the topic.

Should dependencies weigh into the search score for a library?

View default.hbs
<!DOCTYPE html>
<html lang="en">
<head>
<title>{{ title }}</title>
</head>
<body>
<div class="page-wrap" id="page-content-container">
{% body %}
</div>
</body>