Skip to content

Instantly share code, notes, and snippets.

View thedaviddias's full-sized avatar
🌍

David Dias thedaviddias

🌍
View GitHub Profile

Storybook Docs w/ CRA & TypeScript

This is a quick-and-dirty walkthrough to set up a fresh project with Storybook Docs, Create React App, and TypeScript. If you're looking for a tutorial, please see Design Systems for Developers, which goes into much more depth but does not use Typescript.

The purpose of this walkthrough is a streamlined Typescript / Docs setup that works out of the box, since there are countless permutations and variables which can influence docs features, such as source code display, docgen, and props tables.

Step 1: Initialize CRA w/ TS

npx create-react-app cra-ts --typescript
@thedaviddias
thedaviddias / get_title_and_url.applescript
Created October 2, 2019 02:04 — forked from vitorgalvao/Get Title and URL.applescript
AppleScript and JavaScript for Automation to get frontmost tab’s url and title of various browsers.
-- AppleScript --
-- This example is meant as a simple starting point to show how to get the information in the simplest available way.
-- Keep in mind that when asking for a `return` after another, only the first one will be output.
-- This method is as good as its JXA counterpart.
-- Google Chrome
tell application "Google Chrome" to return title of active tab of front window
tell application "Google Chrome" to return URL of active tab of front window
-- Google Chrome Canary
@thedaviddias
thedaviddias / index.html
Created September 19, 2019 15:25
00-header.html
<!DOCTYPE html>
<html>
<head>
</head>
<body>
</body>
</html>
@thedaviddias
thedaviddias / sample.js
Created February 19, 2019 18:45 — forked from tushuhei/sample.js
Getting Website Title with Headless Chrome
const CDP = require('chrome-remote-interface');
const chromeLauncher = require('lighthouse/chrome-launcher/chrome-launcher');
function onPageLoad(Runtime) {
const js = "document.querySelector('title').textContent";
return Runtime.evaluate({expression: js}).then(result => {
console.log('Title of page: ' + result.result.value);
});
}
@thedaviddias
thedaviddias / repo-reset.md
Created July 20, 2018 15:38 — forked from heiswayi/repo-reset.md
GitHub - Delete commits history with git commands

First Method

Deleting the .git folder may cause problems in our git repository. If we want to delete all of our commits history, but keep the code in its current state, try this:

# Check out to a temporary branch:
git checkout --orphan TEMP_BRANCH

# Add all the files:
git add -A
@thedaviddias
thedaviddias / README-Template.md
Created November 18, 2017 02:50 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@thedaviddias
thedaviddias / index.html
Created November 14, 2017 22:01
[Front-End Checklist] - Preloading
<link rel="preload" href="app.js">
@thedaviddias
thedaviddias / index.html
Created November 14, 2017 22:00
[Front-End Checklist] - Prefetching
<link rel="prefetch" href="image.png">
@thedaviddias
thedaviddias / index.html
Created November 14, 2017 21:58
[Front-End Checklist] - Preconnect
<link rel="preconnect" href="https://example.com">
@thedaviddias
thedaviddias / index.html
Last active November 14, 2017 21:57
[Front-End Checklist] - DNS Prefetch
<link rel="dns-prefetch" href="https://example.com">