Skip to content

Instantly share code, notes, and snippets.

View jonschlinkert's full-sized 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 / Makefile
Created July 6, 2019 11:30 — forked from mpneuried/Makefile
Simple Makefile to build, run, tag and publish a docker containier to AWS-ECR
# import config.
# You can change the default config with `make cnf="config_special.env" build`
cnf ?= config.env
include $(cnf)
export $(shell sed 's/=.*//' $(cnf))
# import deploy config
# You can change the default deploy config with `make cnf="deploy_special.env" release`
dpl ?= deploy.env
include $(dpl)
@jonschlinkert
jonschlinkert / recorder.js
Created September 4, 2019 07:55
Simple function for "recording" events and persisting them to the file system. Useful for debugging.
'use strict';
const fs = require('fs');
const path = require('path');
module.exports = name => {
const datapath = path.join(__dirname, `${name}.json`);
const history = [];
const record = (input, key) => {
const NEWLINE_REGEX = /\r?\n/;
const INCLUDE_REGEX = /^(\s*)include\(([A-Z][0-9a-zA-Z]*?)\)/;
const SECTION_START_REGEX = /^([a-z]+) ([A-Z][0-9a-zA-Z]*?)\s*{/;
const SECTION_END_REGEX = /(?<=})/;
class Section {
type = '';
name = '';
leading = [];
body = [];
@jonschlinkert
jonschlinkert / patchy-patch-patch.md
Created June 19, 2019 17:37
The very brief guide to getting rid of NPM's annoying "vulnerability" messages for packages that have been patched.

How to get the latest patch

This little guide describes what to do when:

  1. You see a vulnerability warning for a package, and
  2. The package has already been fixed, and a patch version has been released.

TLDR;

  1. Delete all lock files
@jonschlinkert
jonschlinkert / markdown-toc_repeated-headings.md
Created December 15, 2015 19:42
Example table of contents generated by markdown-toc, correctly links repeated headings.
@jonschlinkert
jonschlinkert / open-iterm-from-finder.md
Last active May 24, 2022 01:33
Add an icon to your finder toolbar to open iTerm in the current folder.

Open iTerm from finder

The code and instructions in this gist are from http://peterdowns.com/posts/open-iterm-finder-service.html. I've had to do this a few times and wanted to distill it the basics.

  1. Open Automator
  2. Create an Application
  3. Choose Actions > Utilities > Run Applescript
  4. Paste the contents of open_in_iterm.app into the window.
  5. Save the script somewhere convenient
  6. Find the script, then drag the script onto the Finder window while holding the command key (or in Yosemite, the command + option keys)
@jonschlinkert
jonschlinkert / first-amendment.md
Last active November 16, 2021 17:36
Free speech is not without exceptions.

What Does Free Speech Mean?

Among other cherished values, the First Amendment protects freedom of speech. The U.S. Supreme Court often has struggled to determine what exactly constitutes protected speech. The following are examples of speech, both direct (words) and symbolic (actions), that the Court has decided are either entitled to First Amendment protections, or not.

Freedom of speech includes the right:

  • Not to speak (specifically, the right not to salute the flag). West Virginia Board of Education v. Barnette, 319 U.S. 624 (1943).
  • Of students to wear black armbands to school to protest a war (“Students do not shed their constitutional rights at the schoolhouse gate.”). Tinker v. Des Moines, 393 U.S. 503 (1969).
  • To use certain offensive words and phrases to convey political messages. Cohen v. California, 403 U.S. 15 (1971).
  • To contribute money (under certain circumstances) to political campaigns. Buckley v. Valeo, 424 U.S. 1 (1976).

Guide to Contributing to Enquirer

Welcome!

Thanks for choosing to contribute to Enquirer! We're so happy that you're contributing to open source projects, and we're even happier that one of those projects is ours!

Teamwork

There is no faster, more effective way to improve a product than from the feedback from the first experience of a new user -- Jon Schlinkert

(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?

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.13333329558372498</real>