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
var mm = require('micromatch');
var ast = mm.parse('*(*(of*(a)x)z)', {sourcemap: true});
console.log(ast);
// results in:
{ type: 'root',
errors: [],
nodes:
[ { type: 'bos', val: '' },
{ type: 'paren',
@jonschlinkert
jonschlinkert / regex-braces-vs-minimatch.js
Last active October 10, 2016 23:44
this is a not-too-crazy pattern. It's just a date range, it could easily be a lot more complicated. By why even have to worry about how complicated your brace pattern is?
/**
* Results:
*
* - braces regex: 73 characters
* - minimatch regex: 26,918 characters
*/
console.log('braces.makeRe: "foo/{1900..2016}/bar/{a..j}/baz"');
console.log(braces.makeRe('foo/{1900..2016}/bar/{a..j}/baz'));
//=> /^(?:foo\/(190[0-9]|19[1-9][0-9]|200[0-9]|201[0-6])\/bar\/([a-j])\/baz)$/
[07:21:37] Using gulpfile ~/dev/micromatch/braces-dev/gulpfile.js
[07:21:37] Starting 'test'...
compiler
✓ should compile: 0{1..9} {10..20}
✓ should compile: \{a,b,c,d,e}
✓ should compile: a${b}c
✓ should compile: a/\{b,c,d,{x,y}}{e,f\}/g
✓ should compile: a/\{b,c,d\}\{e,f\}/g

Hello, and thanks for contributing to <%= name %>!

tldr

There are three main goals in this document, depending on the nature of your pr:

  • description: please tell us about your pr
  • checklist: please review the checklist that is most closly related to your pr
  • contributors list: you're one of us now, please add yourself to package.json and let the world know!
@jonschlinkert
jonschlinkert / zip.js
Last active February 8, 2024 08:26
versatile JavaScript "zip" function. Works with objects, arrays, and yep - even strings.
function zip(a, b) {
var arr = [];
for (var key in a) arr.push([a[key], b[key]]);
return arr;
}
console.log(zip('foo', 'bar'));
//=> [ [ 'f', 'b' ], [ 'o', 'a' ], [ 'o', 'r' ] ]
console.log(zip(['a', 'b', 'c'], ['x', 'y', 'z']));
@jonschlinkert
jonschlinkert / github-base-test.txt
Created September 9, 2016 14:48
"gist update test Thu Mar 04 2021 20:08:05 GMT-0500 (Eastern Standard Time)"
Foo bar baz
title description related
Plugins overview
High level overview of plugins and how they work.
docs libs
streams
assemble-fs
base-fs
assemble-streams

Depending on your needs, there are two different kinds of plugins available. PThis document provides a brief description of each, along with links to addtional information.

Install

Install with npm:

$ npm install --save is-installed

Why use this?

Cheatsheet

Move cursor

command description
ctrl+a Move cursor to the start of the line
ctrl+e Move cursor to the end of the line
or ctrl+b Move cursor back one character
▶ or ctrl+f Move cursor forward one character

Instructions for how to easily open sublime text from the command line, or open files or folders in sublime text from the command line.

Open sublime text from the command line:

$ st

Open a specific file in sublime text from the command line: