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 / 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 / .babelrc
Created February 13, 2017 12:24 — forked from dengjonathan/.babelrc
Webpack/ Babel/ Express Env for React
{
"plugins": ["react-hot-loader/babel"],
"ignore":[]
}
@thedaviddias
thedaviddias / README.md
Created December 7, 2016 01:55 — forked from redoPop/README.md
Hazel: "photo taken" custom date attribute

At the time of writing, Hazel's default date attributes all refer to an image file's creation date rather than the date on which the photo was originally taken. The two dates may differ.

This script provides a custom date attribute reflecting the time the photo was actually taken. As written, it's intended to be added as an embedded script in a "Run JavaScript" rule action, so that it's custom attribute can be used in subsequent "Sort into subfolder" patterns.

The date this script exposes is obtained via sips -g creation [filename]. It's not clear to me exactly which EXIF attribute the sips "creation" property comes from, but it seems reasonable to assume it's either DateTimeOriginal or DateTimeDigitized.

@thedaviddias
thedaviddias / index.html
Created October 20, 2016 11:56 — forked from nhoizey/index.html
Un affichage de numéro vert avec Microformat et mise en forme en CSS
<!-- Live demo : http://bl.ocks.org/1213727 -->
<html>
<head>
<title>Un affichage de numéro vert avec Microformat et mise en forme en CSS</title>
<link rel="stylesheet" media="all" href="numero_vert.css" type="text/css" />
</head>
<body>
<span class="vcard numerovert">
<span class="fn">Nom de la société</span>
@thedaviddias
thedaviddias / OmniFocus_Due_List.scpt
Created October 18, 2016 07:56 — forked from mygeekdaddy/OmniFocus_Due_List.scpt
Generate MD file for tasks due within +/- 7d of current date
(*
File: OmniFocus_Due_List.scpt
Revision: 1.0
Revised: 2015-07-01
Summary: Create taskpaper list of tasks due +/- 7d from current date.
-----------------------------------------------------------
Script based on Justin Lancy (@veritrope) from Veritrope.com
@thedaviddias
thedaviddias / gulpfile.js
Created August 19, 2016 08:07 — forked from danharper/gulpfile.js
New ES6 project with Babel, Browserify & Gulp
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var babel = require('babelify');
function compile(watch) {
var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel));