Skip to content

Instantly share code, notes, and snippets.

View ravidsrk's full-sized avatar

Ravindra Kumar ravidsrk

View GitHub Profile
dhh / Gemfile
Created June 24, 2020 22:23
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
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";
pedrouid /
Last active September 10, 2019 09:34
Migrating Web3Connect from v1.0.0-beta.19 to v1.0.0-beta.20


Migrating from v1.0.0-beta.19 to v1.0.0-beta.20

In this last release, we've refactored the library considerably which includes breaking changes from the previous release. But you will be please to know that we reduced the bundle size from 3.91 mb to 314 kb!! That's a 92% bundle size decrease!!!!

However this comes with its own caveats. Check the two sections bellow for the changes made for Install, Options and Single Provider


akhgupta /
Last active March 12, 2020 11:57
gradlew Shell script Wrapper to Suspend Android Studio before running Gradle Task and resuming once Task is completed
#!/usr/bin/env bash
pkill -SIGSTOP studio
printf "============> Suspending Android Studio <============"
gradleCommand="./gradlew ${@}"
eval ${gradleCommand}
pkill -SIGCONT studio
printf "============> Resume Android Studio <============"
whoisryosuke /
Created April 13, 2019 19:08
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}
BjornvdLaan / ECDSA.sol
Created August 12, 2018 15:03
Verification of externally created ECDSA signatures in Solidity
pragma solidity ^0.4.24;
contract ECDSA {
function verify() public returns (bool) {
bytes32 message = ethMessageHash("TEST");
bytes memory sig = hex"bceab59162da5e511fb9c37fda207d443d05e438e5c843c57b2d5628580ce9216ffa0335834d8bb63d86fb42a8dd4d18f41bc3a301546e2c47aa1041c3a1823701";
address addr = 0x999471bb43b9c9789050386f90c1ad63dca89106;
pragma solidity ^0.4.21;
import "../../node_modules/zeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "../../node_modules/zeppelin-solidity/contracts/ownership/Ownable.sol";
import "../webshop/Webshop.sol";
contract Escrow is Ownable {
enum PaymentStatus { Pending, Completed, Refunded }
event PaymentCreation(uint indexed orderId, address indexed customer, uint value);
// Addresses
var contractAddress = "0xContractAddress";
var userAddress = "0xUserAddress";
// Message to sign : contract address + address to give access
var message = web3.sha3(contractAddress.substr(2) + userAddress.substr(2), {encoding: 'hex'})
// Signing message (with "\x19Ethereum Signed Message:\n32" as prefix by default)
web3.personal.sign(message, web3.eth.defaultAccount, (err, res) => sign = res)
PrashamTrivedi / DbSchema.kt
Last active March 26, 2019 12:28
Some extension functions with room: Requires Export schema Read this section
import com.squareup.moshi.Json
data class DbSchema(@field:Json(name = "formatVersion") val formatVersion: Int? = 0, @field:Json(
name = "database") val database: Database? = Database())
data class Database(@field:Json(name = "version") val version: Int = 0, @field:Json(name = "identityHash") val identityHash: String? = "", @field:Json(
name = "entities") val entities: List<Entity?>? = listOf(), @field:Json(name = "setupQueries") val setupQueries: List<String?>? = listOf())
gakonst / EventTest.js
Last active August 21, 2018 19:21
Examples of event logging in web3.js. Take note that when used with testrpc/ganache, there are various bugs where events don't get fired or get fired twice. More here: I also prefer using async/await instead of callbacks.
pragma solidity ^0.4.18;
contract EventTest {
event LogEventTest(uint _x);
event LogOtherEventTest(address indexed _sender);
function emitEvent(uint x) public {