Skip to content

Instantly share code, notes, and snippets.

View Markkop's full-sized avatar
Keeping up with AI

Marcelo Kopmann Markkop

Keeping up with AI
View GitHub Profile
@Markkop
Markkop / prompt.md
Last active April 14, 2023 14:39
A ChatGPT prompt to create a React progress bar component

Create a React component with tailwind for me.

It is a progress bar to track the user's progress level.
The text and the vertical line must be at the end of the current progress bar.
The background is transparent.

The component has this ASCII representation:

                            │
                            │
@Markkop
Markkop / fipe.js
Last active April 11, 2023 17:02
Show FIPE Price on WebMotors Car Card
// ==UserScript==
// @name Show FIPE Price on WebMotors Car Card
// @namespace Violentmonkey Scripts
// @match https://www.webmotors.com.br/*
// @grant none
// @version 1.0
// @author Marcelo "Mark" Kopmann
// ==/UserScript==
(async () => {
@Markkop
Markkop / fipe.js
Created April 11, 2023 03:25
Get FIPE Table value and displays it on top of the current price
(async () => {
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
const processVehicleCard = async (vehicleCard) => {
const title = vehicleCard.querySelector('h2').innerText;
const subTitle = vehicleCard.querySelector('h3').innerText;
const [make, model] = title.split(' ');
const imgAlt = vehicleCard.querySelector('img').alt;
@Markkop
Markkop / createPullRequest.sh
Created March 31, 2023 16:48
Bash script to create a PR using the current branch name
#!/bin/bash
branch_name=$(git rev-parse --abbrev-ref HEAD)
jira_id_lowercase=$(echo "$branch_name" | grep -o -E '[a-zA-Z]+-[0-9]+' | head -n1)
jira_id_uppercase=$(echo "$jira_id_lowercase" | tr '[:lower:]' '[:upper:]')
title=$(echo "$branch_name" | sed -E "s/$jira_id_lowercase-([^-]+.*)/\1/g" | sed 's/-/ /g')
title="${title#* }" # remove first word (feature/hotfix/etc)
if [[ -z "$jira_id_lowercase" ]]; then
@Markkop
Markkop / setup.md
Last active September 20, 2023 19:21
Mark's Dev Setup
@Markkop
Markkop / compareDownloads.js
Created July 30, 2022 22:22
Compare webpage course videos with the downloaded files to check if you didn't miss one
var fs = require('fs');
// Use this to obtain the video names and copy the resulting array
// [...document.querySelectorAll('.heading h3')].map(el => el.innerText).sort((a,b) => (a.localeCompare(b)))
// Paste and assing the array to this variable
const webVideos = []
function compareDownloads() {
try {
// This works
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.0;
contract AttackKing {
function attack(address payable _kingAddress) public payable {
(bool success,) = _kingAddress.call.gas(10000000).value(msg.value)("");
require(success, "Failed to send value!");
}
}
@Markkop
Markkop / GasSaverRewards.sol
Created April 15, 2022 02:27
A gas saver implementation for the calculating staking rewards
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.4;
import "hardhat/console.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./RewardToken.sol";
contract StakingManager is Ownable{
@Markkop
Markkop / SimpleRewards.sol
Created April 15, 2022 02:16
A staking contract using a loop to save rewards data for each staker
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.4;
import "hardhat/console.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./RewardToken.sol";
contract StakingManager is Ownable{
@Markkop
Markkop / contracts...Ballot.sol
Created April 7, 2022 20:23
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
/// @title Voting with delegation.
contract Ballot {
// This declares a new complex type which will
// be used for variables later.
// It will represent a single voter.
struct Voter {
uint weight; // weight is accumulated by delegation
bool voted; // if true, that person already voted