Skip to content

Instantly share code, notes, and snippets.

View ravidsrk's full-sized avatar

Ravindra Kumar ravidsrk

View GitHub Profile
const _ = require("lodash");
const BnbApiClient = require("@binance-chain/javascript-sdk");
const kava = require("@kava-labs/javascript-sdk");
const bnbCrypto = BnbApiClient.crypto;
const KavaClient = kava.KavaClient;
const kavaUtils = kava.utils;
const BINANCE_CHAIN_DEPUTY = "tbnb1et8vmd0dgvswjnyaf73ez8ye0jehc8a7t7fljv";
const bnbAddress = "your binance chain testnet address";
ravidsrk /
Created April 14, 2019 19:52 — forked from whoisryosuke/
Prettier - Format or unminify code (single file or any folder of certain files)
# Quickly fix one file
npx prettier --write your-file.html
# Quickly fix all files of one type
npx prettier --write src/**/*.{js,jsx}
ravidsrk /
Created March 27, 2019 15:29 — forked from NigelEarle/
Migration and seeding instructions using Knex.js!

Migrations & Seeding

What are migrations??

Migrations are a way to make database changes or updates, like creating or dropping tables, as well as updating a table with new columns with constraints via generated scripts. We can build these scripts via the command line using knex command line tool.

To learn more about migrations, check out this article on the different types of database migrations!

Creating/Dropping Tables

ravidsrk / pget.go
Created March 18, 2019 07:39 — forked from montanaflynn/pget.go
Bounded Parallel Get Requests in Golang
package main
import (
// a struct to hold the result from each request including an index
ravidsrk /
Created November 28, 2018 08:35 — forked from joepie91/
Secure random values (in Node.js)

Not all random values are created equal - for security-related code, you need a specific kind of random value.

A summary of this article, if you don't want to read the entire thing:

  • Don't use Math.random(). There are extremely few cases where Math.random() is the right answer. Don't use it, unless you've read this entire article, and determined that it's necessary for your case.
  • Don't use crypto.getRandomBytes directly. While it's a CSPRNG, it's easy to bias the result when 'transforming' it, such that the output becomes more predictable.
  • If you want to generate random tokens or API keys: Use uuid, specifically the uuid.v4() method. Avoid node-uuid - it's not the same package, and doesn't produce reliably secure random values.
  • If you want to generate random numbers in a range: Use random-number-csprng.

You should seriously consider reading the entire article, though - it's

Principles of Adult Behavior

  1. Be patient. No matter what.
  2. Don’t badmouth: Assign responsibility, not blame. Say nothing of another you wouldn’t say to him.
  3. Never assume the motives of others are, to them, less noble than yours are to you.
  4. Expand your sense of the possible.
  5. Don’t trouble yourself with matters you truly cannot change.
  6. Expect no more of anyone than you can deliver yourself.
  7. Tolerate ambiguity.
  8. Laugh at yourself frequently.
ravidsrk /
Created August 7, 2018 10:25 — forked from joepie91/
Rendering pages server-side with Express (and Pug)


  • View: Also called a "template", a file that contains markup (like HTML) and optionally additional instructions on how to generate snippets of HTML, such as text interpolation, loops, conditionals, includes, and so on.
  • View engine: Also called a "template library" or "templater", ie. a library that implements view functionality, and potentially also a custom language for specifying it (like Pug does).
  • HTML templater: A template library that's designed specifically for generating HTML. It understands document structure and thus can provide useful advanced tools like mixins, as well as more secure output escaping (since it can determine the right escaping approach from the context in which a value is used), but it also means that the templater is not useful for anything other than HTML.
  • String-based templater: A template library that implements templating logic, but that has no understanding of the content it is generating - it simply concatenates together strings, potenti
ravidsrk / createContract.js
Created July 29, 2018 18:45 — forked from frozeman/createContract.js
Deploy contracts on Ethereum and reliable get the contract address
// -> Soldity
// **********
// Your Soldity contract
event Created(bytes32 indexed identifier);
contract MyContract {
function MyContract(bytes32 identifier) {
ravidsrk /
Created September 12, 2017 02:38 — forked from cketti/
Build your own android-26 sources

If you are annoyed that "Sources for Android 26" are not yet available via SDK manager, this might be for you:

  1. Collect source files
mkdir android-sdk-source-build
cd android-sdk-source-build

mkdir -p frameworks/base

#Jetbrains IDE Essential Shortcuts

This is a list of Jetbrains IDE shortcuts I use everyday.

Comments welcome! Tell me your favorites.

##Navigating Between Windows

###Change Focus to Window