Skip to content

Instantly share code, notes, and snippets.

@shobhitsharma
shobhitsharma / SassMeister-input.scss
Created June 1, 2020 10:29 — forked from pascalduez/SassMeister-input.scss
Some Sass string functions: capitalize, ucwords, camelize, ...
// ----
// Sass (v3.3.4)
// Compass (v1.0.0.alpha.18)
// ----
// Capitalize string
// --------------------------------------------------------------------------------
// @param [string] $string
// --------------------------------------------------------------------------------
// @return [string]
import { css, cx } from "linaria";
import React, { ReactHTML } from "react";
import { neutral } from "../../theme/colors/colors";
/** Props for Typography. */
export interface TypographyProps {
/** The children to apply the formatting to. */
children?: React.ReactNode;

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
@shobhitsharma
shobhitsharma / web-servers.md
Created January 18, 2020 10:23 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@shobhitsharma
shobhitsharma / assertions.go
Created July 23, 2019 13:03
Golang Custom Assertions
package test_utils
import (
"fmt"
"reflect"
"strings"
)
// Assertion represents a fact stated about a source object. It contains the source object and function to call
type Assertion struct {
@shobhitsharma
shobhitsharma / localIdent.js
Created July 12, 2019 12:03
localIdent.js
function getLocalIdent(context, localIdentName, localName, options) {
const fileName = context.resourcePath
? context.resourcePath.replace(/^.*[\\\/]/, "").replace(".style.scss", "")
: uuid();
return `hua-${fileName}__${localName}`;
}
function uuid() {
var firstPart = (Math.random() * 46656) | 0;
var secondPart = (Math.random() * 46656) | 0;
//App structure:
// app_folder/
// webpack.config.js
// /server/
// server.js
// /src/
// index.js
// How to run: from root folder run command: "node server/server"
@shobhitsharma
shobhitsharma / postgres-cheatsheet.md
Created May 15, 2019 13:57 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@shobhitsharma
shobhitsharma / generate-ssh-key.sh
Created April 9, 2019 07:52 — forked from grenade/01-generate-ed25519-ssh-key.sh
Correct file permissions for ssh keys and config.
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/mozilla_rsa