Skip to content

Instantly share code, notes, and snippets.

@shobhitsharma
shobhitsharma / braking.md
Created July 27, 2023 20:02 — forked from andrebq/braking.md
Fahrschule

Braking

Standard Braking Distance

  • DE: (Geschwindigkeit / 10) * (Geschwindigkeit / 10)
  • EN: (Speed / 10) * (Speed / 10)

Evasive (Emergency) Braking Distance

  • DE: ((Geschwindigkeit / 10) * (Geschwindigkeit / 10)) / 2
  • EN: ((Speed / 10) * (Speed / 10)) / 2
@shobhitsharma
shobhitsharma / Grundstoff.md
Created July 27, 2023 20:01 — forked from ElioLopez/Grundstoff.md
Fahrschule, driving license germany, berlin

While driving on the motorway you overtake several vehicles. A vehicle approaches you from behind with indicators and headlights flashing. What should you do?

  • I brake briefly to prompt the vehicle behind to keep its distance
  • I continue driving until I can again pull into the right-hand lane
  • I turn on my hazard lights briefly to urge the vehicle behind to keep its distance

When must you switch on the hazard lights on your vehicle? If my vehicle

  • is being towed
  • experiences a breakdown at a place where the view is obscured
  • is briefly double-parked by me
@shobhitsharma
shobhitsharma / bigONotation.js
Created July 20, 2021 07:47 — forked from jhwheeler/bigONotation.js
Big O Notation Exercises
// 1. Even or odd
function isEven(value){
if (value % 2 == 0){
return true;
}
else
return false;
}
@shobhitsharma
shobhitsharma / mixins.scss
Created July 12, 2020 17:01
IE 11 - CSS Grid - SASS mixins
// Ensure CSS grid works with IE 11 spec.
// https://css-tricks.com/browser-compatibility-css-grid-layouts-simple-sass-mixins/
// sass-lint:disable no-vendor-prefixes, no-duplicate-properties
@mixin display-grid {
display: -ms-grid;
display: grid;
}
// $columns values should be delimited by a space
@mixin grid-template-columns($columns...) {
@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]

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
//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