Skip to content

Instantly share code, notes, and snippets.

@veox
veox / erc20.abi.json
Created January 21, 2018 14:59
ERC20 ABI in JSON format
[
{
"constant": true,
"inputs": [],
"name": "name",
"outputs": [
{
"name": "",
"type": "string"
}
@tanaikech
tanaikech / submit.md
Last active October 3, 2025 09:18
Benchmark: fetchAll method in UrlFetch service for Google Apps Script

Benchmark: fetchAll method in UrlFetch service for Google Apps Script

By Google's update at January 19, 2018, fetchAll method was added to the UrlFetch service. When I saw the usage, I couldn't find the detail information about the actual running state. So I investigated about it.

As the result, it was found that the fetchAll method is worked by the asynchronous processing. The returned data is reordered by the order of requests. By this, it was also found that if you want to retrieve the data from the several URL, the process cost of UrlFetchApp.fetchAll() is much lower than that of UrlFetchApp.fetch() using for loop.

The sample scripts for server side and client side are as follows.

Sample script for server side

In this report, 5 Web Apps were used as the servers. At first, 5 standalone projects were created and the following server script was put to each project. Then, Web Apps was deployed for ea

@joeytwiddle
joeytwiddle / async-await-forEach-alternatives.md
Last active October 24, 2025 14:23
Do not use forEach with async-await

Do not use forEach with async-await

TLDR: Use for...of instead of forEach() in asynchronous code.

For legacy browsers, use for(...;...;...) or [].reduce()

To execute the promises in parallel, use Promise.all([].map(...))

The problem

@tanaikech
tanaikech / submit.md
Last active May 20, 2025 20:41
Adding Query Parameters to URL using Google Apps Script

Adding Query Parameters to URL using Google Apps Script

Updated on February 5, 2024

This is for adding the query parameters to the URL. These scripts can be also used for Javascript. When I created an endpoint with some query parameters, I had used the scripts of various patterns every time. Today, I prepared this sample script to unify them. If this is also useful for you, I'm glad.

Sample script (With V8 runtime):

String.prototype.addQuery = function (obj) {
@Foadsf
Foadsf / .gitignore
Last active February 12, 2022 00:00
Scilab Serial Communication Toolbox (SSCT) --> this Gist is deprecated. please use https://github.com/Foadsf/ssct
docinfo.html
Documentation.md
pics/
import numpy as np
import casadi
from casadi import SX, DM
from math import cos, sin
import cv2
# State Vector Indices
index_mass = 0
index_position_x = 1
index_position_y = 2
@natanlao
natanlao / github-global-node-id.md
Last active September 17, 2025 11:35
Translating GitHub resource IDs to global node IDs

GitHub associates a unique resource ID (or "database ID" or just "ID") with each API-accessible resource. For example, each [issue][issue-id], [repository][repository-id], and [user][user-id] has a global ID. In my limited experience with it, GitHub's REST API generally does not expose endpoints by which resources can be queried by ID (though it does have some [undocumented endpoints][repo-rest]). These resource IDs have been superseded by distinct [global node IDs][global-ids] (node_id). GitHub's GraphQL API allows retrieval of a node by its ID, called a "direct node lookup".

As you can tell, you likely don't have much reason to interact with the older

@lucashmsilva
lucashmsilva / TESOURODIRETO(taxa).js
Last active February 24, 2025 15:24
API para criar a função TESOURODIRETO Google Sheets
/*
* @return Retorna a cotação atual de um título específico do Tesouro Direto Junto com a taxa anual de retorno
* @customfunction
**/
function TESOURODIRETO(bondName) {
let srcURL = "https://www.tesourodireto.com.br/json/br/com/b3/tesourodireto/service/api/treasurybondsinfo.json";
let jsonData = UrlFetchApp.fetch(srcURL);
let parsedData = JSON.parse(jsonData.getContentText()).response;
for(let bond of parsedData.TrsrBdTradgList) {
@mayrsascha
mayrsascha / UrlFetchAppWithRetries.gs
Last active May 21, 2025 13:36 — forked from Bajena/RetriableRequestsBatch.gs
Retriable requests batch for Google Apps Scripts. Originally seen on https://medium.com/@sidehacker/nice-did-you-consider-making-this-a-gas-library-dee19ce3db4a. Install it by adding the library script ID "16rm4lelUzHsrF_vLJOwYFh6HvnZHM5LhT8zOn45YvdeQdsZVZmlIOhDP".
/**
* --- UrlFetchApp WITH retries ---
*
* Don't let your script fail easily because of bad API uptime.
*
* Calls provided HTTP requests batch and retries in case of errors. This function has the same
* params and return value as URLFetchApp.fetchAll().
* https://developers.google.com/apps-script/reference/url-fetch/url-fetch-app#fetchurl-params
*
* @param {Array<object>} requests - Array of request param objects
@shanerbaner82
shanerbaner82 / MintFunction
Created August 31, 2021 17:36
Mint w Gas
async mint(context, amount) {
const mintValue = web3.utils.toWei((amount * context.state.contractData.nftPrice).toString(), 'ether');
const contract = new web3.eth.Contract(ABI, process.env.CONTRACT_ADDRESS);
try {
const value = web3.utils.toHex(mintValue);
const data = contract.methods.mintFunction(amount).encodeABI();
const transactionParameters = {