Skip to content

Instantly share code, notes, and snippets.

{"schemaVersion": 1, "label": "coverage", "message": "80%", "color": "brightgreen"}
@rezaiyan
rezaiyan / lexicon-coverage.json
Last active April 24, 2026 20:34
Lexicon code coverage badge
{"schemaVersion":1,"label":"coverage","message":"54.7%","color":"yellow"}
@Composable
fun PriceGraph(
priceHistory: List<Double>,
modifier: Modifier = Modifier,
lineColor: Color = Color.Black
) {
val path = remember { Path() }
val offsetX = remember { androidx.compose.animation.core.Animatable(0f) }
@rezaiyan
rezaiyan / SmartContract.html
Created December 17, 2023 12:31
This HTML file establishes a web interface for interacting with a smart contract deployed on Ganache CLI. It utilizes the Web3 library for Ethereum interactions and displays transaction information in a table. The displayed transactions include details such as transaction hash, sender, recipient, value, gas price, and more. Additionally, it inco…
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ganache CLI Transactions</title>
<style>
table {
border-collapse: collapse;
@rezaiyan
rezaiyan / transfer.js
Created December 16, 2023 21:51
This is a script for creating and sending an Ethereum transaction using the Web3 library and EthereumJS. It demonstrates how to set up the transaction parameters, sign it with a private key, and send it using Ganache, a local Ethereum blockchain emulator. Feel free to use and modify this code for your Ethereum-related projects.
const { Web3 } = require('web3');
const EthereumTransaction = require('ethereumjs-tx').Transaction;
// Step 1: Set up the appropriate configuration
const web3 = new Web3(new Web3.providers.HttpProvider('http://127.0.0.1:7545'));
async function transfer() {
// Step 2: Set the sending and receiving addresses for the transaction
const sendingAddress = 'sendingAddress';
const receivingAddress = 'receivingAddress';
@rezaiyan
rezaiyan / MockResponse.kt
Created October 21, 2022 07:05
Mock response
val client = OkHttpClient.Builder()
.addInterceptor(MockInterceptor())
.build()
//-------------------------
import okhttp3.Interceptor
import okhttp3.Protocol
import okhttp3.Response
import okhttp3.ResponseBody.Companion.toResponseBody
#!/bin/bash
#hi
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
for rootFolder in */ ; do
if [ -d $rootFolder"build" ]; then
echo "do you want to delete build folders of \"${rootFolder%?}\" project?"
read ans
if [ "$ans" = "y" ] || [ "$ans" = "Y" ]; then
@rezaiyan
rezaiyan / build.gradle
Created May 6, 2021 19:16
Add your android library to the sonatype (maven central)
Define these lines to the library gradle file:
project.group = "io.github.rezaiyan"
project.archivesBaseName = "LevelProgressBar"
project.version = "1.0.0"
apply from: '../publish.gradle'
@rezaiyan
rezaiyan / Activity.java
Created March 7, 2021 14:49
Transparent Activity
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
}
}
liveData.observeLimit({
//asset 1
}, {
//assert 2
})...