Skip to content

Instantly share code, notes, and snippets.

View rhlc's full-sized avatar
🎯
Focusing

Rahul rhlc

🎯
Focusing
View GitHub Profile
{
"success": true,
"data": [
{
"_id": "63b7f9546160f9e28ac88c19",
"name": [
"Colombia"
],
"flag": {
"emoji": "🇨🇴",
@rhlc
rhlc / github_gpg_key.md
Created April 30, 2023 12:27 — forked from ankurk91/github_gpg_key.md
Signing git commits using GPG (Ubuntu/Mac)

Github : Signing commits using GPG (Ubuntu/Mac) 🔐

  • Do you have an Github account ? If not create one.
  • Install required tools
  • Latest Git Client
  • gpg tools
# Ubuntu
sudo apt-get install gpa seahorse
# MacOS with https://brew.sh/
@rhlc
rhlc / script.js
Created November 4, 2022 05:53
Add Text Over Image (Using jimp)
// to convert ttf font to fnt use http://www.angelcode.com/products/bmfont/
var Jimp = require("jimp");
const alphabet = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];
const func = async (alphabet) => {
const font = await Jimp.loadFont('font/roboto-slab.fnt');
Jimp.read("base.png", (err, image) => {
if (err) throw err;
image
.print(
font,
{"id":"dfb3a90a9781d0751a4bc89d819bbbeb","_format":"hh-sol-build-info-1","solcVersion":"0.8.17","solcLongVersion":"0.8.17+commit.8df45f5f","input":{"language":"Solidity","sources":{"contracts/BoxV2.sol":{"content":"// contracts/BoxV2.sol\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n \ncontract BoxV2 {\n uint256 private value;\n \n // Emitted when the stored value changes\n event ValueChanged(uint256 newValue);\n \n // Stores a new value in the contract\n function store(uint256 newValue) public {\n value = newValue;\n emit ValueChanged(newValue);\n }\n \n // Reads the last stored value\n function retrieve() public view returns (uint256) {\n return value;\n }\n \n // Increments the stored value by 1\n function increment() public {\n value = value + 1;\n emit ValueChanged(value);\n }\n}\n"}},"settings":{"optimizer":{"enabled":false,"runs":200},"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.m
async function requestAccount() {
const provider = new ethers.providers.Web3Provider(window.ethereum, 'any');
// Prompt user for account connections
await provider.send('eth_requestAccounts', []);
const signer = provider.getSigner();
console.log('Account:', await signer.getAddress());
}
async function fetchGreeting() {
if (typeof window.ethereum !== 'undefined') {
<script
src="https://cdn.ethers.io/lib/ethers-5.2.umd.min.js"
type="application/javascript"
></script>
<script>
async function requestAccount() {
const provider = new ethers.providers.Web3Provider(window.ethereum, 'any');
// Prompt user for account connections
await provider.send('eth_requestAccounts', []);
const signer = provider.getSigner();
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract BatchTransfer is ERC1155, Ownable {
constructor() ERC1155("") {}
function safeBatchTransferFrom(
pragma solidity ^0.8.0;
//SPDX-License-Identifier: MIT
interface IERC1155 {
function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;
function balanceOf(address account) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function setApprovalForAll(address _operator, bool _approved) external;
}
{
"data": {
"project": [
{
"created_at": "2022-02-03T14:21:20.531848+00:00",
"tasks": [
{
"created_at": "2022-02-03T14:24:02.903286+00:00",
"status": "APPROVED",
"task_feedbacks": [
@rhlc
rhlc / plateEditor.tsx
Created October 30, 2021 22:35
Plate editor component
import ReactDOM from 'react-dom'
import React, { useMemo, useState } from 'react'
import {
createPlateComponents,
createPlateOptions,
HeadingToolbar,
PlatePlugin,
Plate,
ToolbarSearchHighlight,
createAlignPlugin,