Skip to content

Instantly share code, notes, and snippets.

@shilman
shilman / storybook-docs-typescript-walkthrough.md
Last active January 29, 2025 02:47
Storybook Docs Typescript Walkthrough

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 --template typescript
@kobeumut
kobeumut / SimpleParsingJson.swift
Created January 5, 2018 19:01
Simple Fetch Url and Parse Json on Swift 4 with codable and URLSession
func fetchResultsFromApi() {
struct MyGitHub: Codable {
let name: String?
let location: String?
let followers: Int?
let avatarUrl: URL?
let repos: Int?
private enum CodingKeys: String, CodingKey {
@birme
birme / lambda-grafana-adapter.js
Created July 17, 2017 13:22
lambda-grafana-adapter
const request = require('request');
const DATA_API = 'https://data.example.com/api';
const DATA_API_KEY = process.env.API_KEY;
exports.search = function(event, context, callback) {
const targets = [ 'ID1', 'ID2', 'ID3' ];
callback(null, targets);
};
@willdages
willdages / slack-interactive-messages-api-gateway-mapping-template.vtl
Last active March 6, 2024 07:37
Slack's Interactive Messages endpoint reports a Content-Type of `application/x-www-form-urlencoded` but responds with something like looks like `payload=%7B%22actions%22%3A%5B%7B%22...`, which is encoded JSON inside the payload parameter, which takes the API Gateway VTL templates for a loop.
## The `substring(8)` returns the input with everything after "payload=" which is the only parameter passed in,
## everything else is encoded JSON inside that parameter.
#set ($encodedJSON = $input.body.substring(8))
$util.urlDecode(${encodedJSON})
@kellyfj
kellyfj / gist:702db34caa807a509c79
Last active April 25, 2019 14:55
To find and clean-up old Git remote branches that have been merged to master
#List all remote branches merged to master
git branch -r --merged
#For all old branches log last commit e.g.
git log --decorate -1 origin/Gauss
#To delete the branches you want
git push origin --delete Gauss
#For everyone to run locally to remove the remove references
@jexchan
jexchan / multiple_ssh_setting.md
Created April 10, 2012 15:00
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"