This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ethers } from "ethers"; | |
import * as fs from "fs"; | |
import * as path from "path"; | |
import * as dotenv from "dotenv"; | |
// Terminal Command: npx ts-node scripts/sendZeroValueToSelf.ts | |
// Used when a transaction fails to send | |
// Load environment variables from .env file | |
dotenv.config(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.24; | |
contract DeleteNumberAtIndexChallenge { | |
struct Number { | |
uint value; | |
} | |
Number[] public numbers; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.24; | |
// Inspired By: https://solidity-by-example.org/hacks/re-entrancy/ | |
/** | |
* @title EtherStore | |
* @dev A simple contract for depositing and withdrawing ETH. | |
* Vulnerable to re-entrancy attack. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.20; | |
import "./ERC20.sol"; | |
import "./interfaces/IERC20.sol"; | |
contract TokenLockers is ERC20 { | |
error InsufficentFunds(); | |
error InsufficentInputValue(); | |
error InvalidLocktime(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form> | |
<h3>FORM</h3> | |
<label>TITLE</label> | |
<input type="title" id="title" placeholder="Title..."> | |
<label>AUTHOR</label> | |
<input type="title" id="author" placeholder="Author..."> | |
<label>ISBN</label> | |
<input type="title" id="isbn" placeholder="Isnb..."> | |
<button>Submit</button> | |
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get(url) { | |
// Return a new promise. | |
return new Promise(function(resolve, reject) { | |
// Do the usual XHR stuff | |
var req = new XMLHttpRequest(); | |
req.open('GET', url); | |
req.onload = function() { | |
// This is called even on 404 etc | |
// so check the status |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//How to use it in a JS file | |
document.addEventListener('DOMContentLoaded', main) | |
const kinvey = new Kinvey('kid_BkYBymjvd', 'ed0eed3599fa4d5d9d062fae8755f43c'); | |
const data = { | |
username: 'guest', | |
password: 'guest' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class httpClient { | |
// Get Request | |
get(url) { | |
return new Promise((resolve, reject) => { | |
fetch(url) | |
.then((res) => { | |
if (res.ok) { | |
return res.json(); | |
} | |
}).then(data => resolve(data)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function linkedList(arr) { | |
return arr.reduceRight((next, value) => ({ value, next }), null); | |
} | |
let l = [3, 1, 2, 3, 4, 5]; | |
console.log(linkedList(l)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Algorithms - Linked List Principles | |
//Language: JavaScript | |
class Node { | |
constructor(data, next = null) { | |
this.data = data; | |
this.next = next; | |
} | |
} |
NewerOlder