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.0; | |
// Define an interface for the telephone contract | |
interface ITelephone { | |
function changeOwner(address _owner) external; | |
} | |
contract MyContract { | |
// The address of the telephone contract |
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
from web3 import Web3 | |
infura_url = # your infura or alchemy api here. You can use a public one as well. | |
web3 = Web3(Web3.HTTPProvider(infura_url)) | |
web3 | |
#<web3.main.Web3 object at 0x103cbf280> | |
print(web3.isConnected()) | |
#True | |
print(web3.eth.blockNumber) | |
#16753992 | |
block = web3.eth.getBlock(16753992) |
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
{ | |
"name": "XtraCheapSwap", | |
"logoURI": "https://ipfs.io/ipfs/QmaypvtnoXGQo4gSGHjgXaMUY98hf2FotQRfXgdLL4jo4i", | |
"keywords": [ | |
"defi" | |
], | |
"timestamp": "2021-02-10T16:00:00.809+00:00", | |
"tokens": [ | |
{ | |
"chainId": 1, |
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 { NgModule } from '@angular/core'; | |
import { BrowserModule } from '@angular/platform-browser'; | |
import { RouterModule } from '@angular/router'; | |
import { Component, Input } from '@angular/core'; | |
/** | |
* Normally, this would be split over multiple files. | |
* Everything is placed into one file here to make it | |
* easier to read. | |
*/ |
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 { NgModule } from '@angular/core'; | |
import { BrowserModule } from '@angular/platform-browser'; | |
import { RouterModule } from '@angular/router'; | |
import { Component, Input } from '@angular/core'; | |
import { AppComponent } from './app.component'; | |
@Component({ | |
template: `<h1>This is Component A</h1>` | |
}) | |
export class ComponentA { |
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 myBind(fn, context, ...args) { | |
return function(...moreArgs) { | |
return fn.call(context, ...(args.concat(moreArgs))); | |
} | |
} | |
// test | |
function add(a,b,c) { | |
return a + b + c; | |
} |
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 curry(fn) { | |
const arity = fn.length; | |
return function $curry(...args) { | |
if (args.length < arity) { | |
return $curry.bind(null, ...args); | |
} | |
return fn.call(null, ...args); | |
}; | |
} |
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 createNode( | |
routeReuseStrategy: RouteReuseStrategy, curr: TreeNode<ActivatedRouteSnapshot>, | |
prevState?: TreeNode<ActivatedRoute>): TreeNode<ActivatedRoute> { | |
// reuse an activated route that is currently displayed on the screen | |
if (prevState && routeReuseStrategy.shouldReuseRoute(curr.value, prevState.value.snapshot)) { | |
const value = prevState.value; | |
value._futureSnapshot = curr.value; | |
const children = createOrReuseChildren(routeReuseStrategy, curr, prevState); | |
return new TreeNode<ActivatedRoute>(value, children); |
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
shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean { | |
return future.routeConfig === curr.routeConfig; | |
} |
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
/** | |
* Does not detach any subtrees. Reuses routes as long as their route config is the same. | |
*/ | |
export class DefaultRouteReuseStrategy implements RouteReuseStrategy { | |
shouldDetach(route: ActivatedRouteSnapshot): boolean { return false; } | |
store(route: ActivatedRouteSnapshot, detachedTree: DetachedRouteHandle): void {} | |
shouldAttach(route: ActivatedRouteSnapshot): boolean { return false; } | |
retrieve(route: ActivatedRouteSnapshot): DetachedRouteHandle|null { return null; } | |
shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean { | |
return future.routeConfig === curr.routeConfig; |
NewerOlder