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
/** | |
* This gist was inspired from https://gist.github.com/homam/8646090 which I wanted to work when uploading an image from | |
* a base64 string. | |
* Updated to use Promise (bluebird) | |
* Web: https://mayneweb.com | |
* | |
* @param {string} base64 Data | |
* @return {string} Image url | |
*/ | |
const imageUpload = async (base64) => { |
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
{"lastUpload":"2021-08-07T10:26:38.950Z","extensionVersion":"v3.4.3"} |
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