Skip to content

Instantly share code, notes, and snippets.

@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
@shobhitsharma
shobhitsharma / docker-swarm-ports.md
Created April 4, 2019 13:43 — forked from BretFisher/docker-swarm-ports.md
Docker Swarm Port Requirements, both Swarm Mode 1.12+ and Swarm Classic, plus AWS Security Group Style Tables

Docker Swarm Mode Ports

Starting with 1.12 in July 2016, Docker Swarm Mode is a built-in solution with built-in key/value store. Easier to get started, and fewer ports to configure.

Inbound Traffic for Swarm Management

  • TCP port 2377 for cluster management & raft sync communications
  • TCP and UDP port 7946 for "control plane" gossip discovery communication between all nodes
  • UDP port 4789 for "data plane" VXLAN overlay network traffic
  • IP Protocol 50 (ESP) if you plan on using overlay network with the encryption option

AWS Security Group Example

IframeClient

Provides simple and reliable cross-origin JavaScript messaging between iframes and their host pages by wrapping window.postMessage in a transactional layer. IframeClient builds atop postMessage in the way that TCP builds atop IP. IframeClient provides request/response cycles with polling and timeouts to (better) guarentee that messages will be received and post back responses.

This repo is configured as an NPM module and a Ruby gem for integration into Node-based projects and Rails applications.

Install

Node

Keybase proof

I hereby claim:

  • I am shobhitsharma on github.
  • I am shobhitsharma (https://keybase.io/shobhitsharma) on keybase.
  • I have a public key ASC96X9yScBqjVXb2mn6zkrpMAPJHNyNcttxnTxOr0Wv-Ao

To claim this, I am signing this object:

import * as React from "react";
import styled from "styled-components";
const CarouselWrapper = styled.div<any>`
display: flex;
height: 100%;
`;
const CarouselFrame = styled.div<any>`
position: relative;