Skip to content

Instantly share code, notes, and snippets.

View jeftarmascarenhas's full-sized avatar
🎯
Focusing

Jeftar Mascarenhas jeftarmascarenhas

🎯
Focusing
View GitHub Profile
@jeftarmascarenhas
jeftarmascarenhas / BinanceWallet.ts
Last active May 5, 2023 14:51
Connector to Binance on Wagmi
import {
ConnectorNotFoundError,
UserRejectedRequestError,
RpcError,
ResourceUnavailableError,
SwitchChainNotSupportedError,
} from "wagmi";
import { InjectedConnector } from "wagmi/connectors/injected";
import { Chain, Ethereum } from "@wagmi/core";
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
contract Lottery {
event Receive(address indexed from, address to, uint amount);
address owner;
address public winner;
uint public totalBets;
@jeftarmascarenhas
jeftarmascarenhas / marketplace.sol
Created April 14, 2022 01:26 — forked from dabit3/marketplace.sol
NFT Marketplace Smart Contract (V2)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "hardhat/console.sol";
contract NFTMarketplace is ERC721URIStorage {
const firstString = '6'
console.log(firstString.padStart(4, '0'))
// result: "0006"
const creditCard = '09290201320409'
const getLast4Digits = (str) => str.slice(-4)
const maskedCreditCardNumber = getLast4Digits(creditCard).padStart(creditCard.length, '*')
@jeftarmascarenhas
jeftarmascarenhas / extract-method-solution2.ts
Created August 19, 2021 19:03
Refactoring Extract Method(Solution 2)
class LongMethod {
quantity: number = 10
itemPrice: number = 34.0
calculateTotal() {
const basePrice = this.quantity * this.itemPrice
if (basePrice > 500) {
return basePrice * 0.95
}
return basePrice * 0.98
@jeftarmascarenhas
jeftarmascarenhas / extract-method-solution1.ts
Created August 19, 2021 17:06
Refactoring Extract Method(Solution 1)
class LongMethod {
description: string = 'I need Refactoring'
printBanner(): void {
console.log('printBanner')
}
getOutMethod(): string {
return 'getOutMethod'
}
@jeftarmascarenhas
jeftarmascarenhas / React Native Clear Cache
Created October 15, 2018 18:13 — forked from jarretmoses/React Native Clear Cache
Clearing the Cache of your React Native Project
RN < 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache
RN >= 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache-* && rm -rf $TMPDIR/metro-bundler-cache-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache
npm >= 5 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache verify && npm install && npm start -- --reset-cache
Windows - del %appdata%\Temp\react-native-* & cd android & gradlew clean & cd .. & del node_modules/ & npm cache clean --force & npm install & npm start -- --reset-cache
@jeftarmascarenhas
jeftarmascarenhas / sketch-never-ending.md
Created January 6, 2018 21:29 — forked from Bhavdip/sketch-never-ending.md
Modify Sketch to never ending trial

###Sketch trial non stop

Open hosts files:

$ open /private/etc/hosts

Edit the file adding:

127.0.0.1 backend.bohemiancoding.com

127.0.0.1 bohemiancoding.sketch.analytics.s3-website-us-east-1.amazonaws.com

{
"id": 85636117,
"name": "react-redux-study",
"full_name": "jeftarmascarenhas/react-redux-study",
"owner": {
"login": "jeftarmascarenhas",
"id": 574887,
"avatar_url": "https://avatars2.githubusercontent.com/u/574887?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/jeftarmascarenhas",
@jeftarmascarenhas
jeftarmascarenhas / api-github.json
Created October 17, 2017 18:32
Example api github hypermedia
{
"current_user_url": "https://api.github.com/user",
"current_user_authorizations_html_url": "https://github.com/settings/connections/applications{/client_id}",
"authorizations_url": "https://api.github.com/authorizations",
"code_search_url": "https://api.github.com/search/code?q={query}{&page,per_page,sort,order}",
"commit_search_url": "https://api.github.com/search/commits?q={query}{&page,per_page,sort,order}",
"emails_url": "https://api.github.com/user/emails",
"emojis_url": "https://api.github.com/emojis",
"events_url": "https://api.github.com/events",
"feeds_url": "https://api.github.com/feeds",