- Get your local IP address
$ ip route
default via IP1 dev wlan0 proto dhcp src IP2 metric 600
IP3/24 dev wlan0 proto kernel scope link src IP2 metric 600| #!/bin/bash | |
| # pass name via $1 | |
| ssh-keygen -t rsa -b 4096 -f ~/.ssh/$1 |
| --- program structure --- | |
| // a Jack program is a collection of files, each should represent a class like the one below | |
| class = "class" className '{' classVarDec* fnDec* '}' ; | |
| classVarDec = ("static" | "field") type varName (',' varName)* ';' ; | |
| fnDec = ("constructor" | "function" | "method") ("void" | type) fnName '(' paramList ')' fnBody ; | |
| paramList = ( (type varName) (',' type varName)* )? ; | |
| fnBody = '{' varDec* statements '}' ; | |
| varDec = "var" type varName (',' type varName)* ';' ; | |
| type = primitive | className ; |
| // Cargo.toml dependencies: | |
| // hex = "0.4.3" | |
| // ethabi = "16.0.0" | |
| use ethabi::*; | |
| use ethabi::ParamType::*; | |
| use ethabi::StateMutability::*; | |
| fn main() { |
| struct In { | |
| a: bool, | |
| b: bool, | |
| } | |
| #[derive(Debug, PartialEq)] | |
| struct Out { | |
| out: bool, | |
| } |
| const assert = require('assert') | |
| function test(title, fn) { | |
| try { | |
| fn() | |
| console.log(`✅ '${title}' test passed`) | |
| } catch (error) { | |
| console.error(`❌ '${title}' test failed`) | |
| throw error | |
| } |
| const getChunk = (arr, from, size) => { | |
| const clampedFrom = (from + size) > arr.length | |
| // Trying to get chunk bigger than end of array. | |
| // Here we reduce `from` so that the chunk size is always preserved. | |
| ? arr.length - size | |
| : from | |
| return arr.slice(clampedFrom, from + size) | |
| } |
Up until now, subgraphs have been using one of the first versions of AssemblyScript (v0.6). Finally we've added support for the newest one available (v0.19.10)! 🎉
That will enable subgraph developers to use newer features of the AS language and standard library.
This guide is applicable for anyone using graph-cli/graph-ts below version 0.22.0. If you're already at a higher than (or equal) version to that, you've already been using version 0.19.10 of AssemblyScript 🙂
Note: As of
0.24.0,graph-nodecan support both versions, depending on theapiVersionspecified in the subgraph manifest.
| document.querySelectorAll('ul.mn-invitation-list button.artdeco-button--secondary').forEach(btn => btn.click()) |
| console.log('flatten list:', [1, 2, 3].flatMap(x => [x * 2])) // [2, 4, 6] |