Skip to content

Instantly share code, notes, and snippets.

@aleclarson
aleclarson / rollup-typescript.md
Last active June 21, 2024 03:25
The best Rollup config for TypeScript libraries

Features

🔥 Blazing fast builds
😇 CommonJS bundle
🌲 .mjs bundle
.d.ts bundle + type-checking
🧐 Source maps

Install

@nicoandrade
nicoandrade / fragments.js
Created October 23, 2019 05:44
Gatsby gatsby-transformer-sharp fragments
/**
* This is a list of the parameters for the gatsby-transformer-sharp fragments
* If you are trying to use, for example, '...GatsbyImageSharpFluid' and you are getting this error:
* Unknown fragment "GatsbyImageSharpFluid"
* Just use the parameters directly
*
* The simplest set of fields for fixed sharp images
* @type {Fragment}
* @example
* childImageSharp {
@shilman
shilman / storybook-docs-typescript-walkthrough.md
Last active May 28, 2024 17:42
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
@kutyel
kutyel / webpack.config.babel.js
Created June 13, 2017 08:21
Webpack 2 with React, CSS Modules & SASS
import webpack from 'webpack';
import { resolve } from 'path';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
import ForceCaseSensitivityPlugin from 'force-case-sensitivity-webpack-plugin';
import autoprefixer from 'autoprefixer';
import getClientEnvironment from './config/env';
const nodeModulesPath = resolve(__dirname, 'node_modules');
const bowerModulesPath = resolve(__dirname, 'bower_components');
const srcPath = resolve(__dirname, 'src');
@butterybread
butterybread / npm-install-shortcuts.md
Created May 25, 2017 08:08
NPM shortcut commands for installation

NPM shortcut commands

  • Installing a package & save to devDependencies npm install {package} --save-dev
    shortcut: npm i {package} -D

  • Installing a package & save to dependencies npm install {package} --save
    shortcut: npm i package -S

@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active July 24, 2024 01:51
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@rublev
rublev / remove-gh-stars.js
Created April 7, 2017 22:36
remove all github stars
// open console and run cmd+v every time
var i = 0;
var el = document.querySelectorAll('[aria-label="Unstar this repository"]');
function myLoop () {
setTimeout(function () {
el[i].click()
i++;
if (i < 30) {

This is unmaintained, please visit Ben-PH/spacemacs-cheatsheet

Useful Spacemacs commands

  • SPC q q - quit
  • SPC w / - split window vertically
  • SPC w - - split window horizontally
  • SPC 1 - switch to window 1
  • SPC 2 - switch to window 2
  • SPC w c - delete current window
@AllThingsSmitty
AllThingsSmitty / script-loaded.js
Created May 5, 2015 13:25
Check if any given script has loaded
var myScript = document.createElement('script');
myScript.src = 'http://code.jquery.com/jquery-2.1.4.min.js';
myScript.onload = function() {
console.log('jQuery loaded.');
};
document.body.appendChild(myScript);
@danrovito
danrovito / countrydropdown.html
Last active July 3, 2024 12:57
HTML Country Select Dropdown List
<label for="country">Country</label><span style="color: red !important; display: inline; float: none;">*</span>
<select id="country" name="country" class="form-control">
<option value="Afghanistan">Afghanistan</option>
<option value="Åland Islands">Åland Islands</option>
<option value="Albania">Albania</option>
<option value="Algeria">Algeria</option>
<option value="American Samoa">American Samoa</option>
<option value="Andorra">Andorra</option>
<option value="Angola">Angola</option>