Skip to content

Instantly share code, notes, and snippets.

View endiliey's full-sized avatar

Endi endiliey

View GitHub Profile
@endiliey
endiliey / build.txt
Last active May 19, 2018 17:41
Docosaurus extension-less build
build/Docusaurus/
├── about-slash
│   └── index.html
├── about-slash.html
├── blog
│   ├── 2017
│   │   └── 12
│   │   └── 14
│   │   ├── introducing-docusaurus
│   │   │   └── index.html
@endiliey
endiliey / build.txt
Created May 31, 2018 17:27
Sub-directories-build-files
build/Docusaurus/docs/
├── 1.0.11
│   ├── api-pages.html
│   ├── blog.html
│   ├── commands.html
│   ├── custom-pages.html
│   ├── doc-markdown.html
│   ├── installation.html
│   ├── navigation.html
│   ├── publishing.html
@endiliey
endiliey / heading.md
Created March 25, 2019 09:05
github heading

Some ! Heading

Some @ Heading

Some # Heading

Some $ Heading

Some % Heading

Some ^ Heading

Some & Heading

Some * Heading

Some ( Heading

Some ) Heading

@endiliey
endiliey / InlineManifestHtmlWebpackPlugin.js
Created April 18, 2019 17:07
InlineManifestHtmlWebpackPlugin
const fs = require('fs');
const path = require(`path`);
class InlineManifestHtmlWebpackPlugin {
constructor(options) {
this.options = Object.assign(
{manifestFileName: 'chunk-map.json', manifestVariable: '__chunkMapping'},
options,
);
}
@endiliey
endiliey / generate.js
Last active May 17, 2019 11:54
Simple node script to generate random GitHub flavored valid markdown
const globby = require("globby");
const fs = require("fs-extra");
const path = require("path");
const fetch = require("node-fetch");
function randomName(length) {
let result = "";
const characters =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
const charactersLength = characters.length;
@endiliey
endiliey / filename.benchmark.js
Created May 19, 2019 08:51
benchmark path.basename(file, path.extname(file)) vs path.parse(file).name
const path = require('path');
const Benchmark = require('benchmark');
const suite = new Benchmark.Suite();
const files = [
'C:\\temp\\myfile.html',
'a.md',
'hello/super.js',
'test.ts',
'superman/hello/haha.md',
@endiliey
endiliey / react-live.md
Created June 4, 2019 08:24
react live testing
function Clock(props) {
  const [date, setDate] = useState(new Date());
  useEffect(() => {
    var timerID = setInterval(() => tick(), 1000);

    return function cleanup() {
      clearInterval(timerID);
    };
 });
export function getIePolyfill(siteDir: string) {
let iePolyfill = '';
const env =
process.env.NODE_ENV === 'production' ? 'production' : 'development';
const supportedBrowsers = browserslist(undefined, {path: siteDir, env});
if (
supportedBrowsers.includes('ie 9') ||
supportedBrowsers.includes('ie 10')
) {
export default function(babel) {
const { types: t } = babel;
return {
name: "ast-transform", // not required
visitor: {
ObjectExpression(path) {
var source = path.node.source.value;
if (source !== '@generated/registry') return;
import matter from 'gray-matter';
import {createHash} from 'crypto';
import _ from 'lodash';
import escapeStringRegexp from 'escape-string-regexp';
import fs from 'fs-extra';
import readline from 'readline';
import {once} from 'events';
function isSeparator(line: string) {