Skip to content

Instantly share code, notes, and snippets.

View james-turner's full-sized avatar

James Turner james-turner

  • PHPNinjas Ltd
  • London, UK
View GitHub Profile
@james-turner
james-turner / warp-pol-value.js
Created February 3, 2022 10:53
Warp POL mechanics
// We require the Hardhat Runtime Environment explicitly here. This is optional
// but useful for running the script in a standalone fashion through `node <script>`.
//
// When running the script with `hardhat run <script>` you'll find the Hardhat
// Runtime Environment's members available in the global scope.
const hre = require("hardhat");
const ethers = hre.ethers;
const {BigNumber} = require("@ethersproject/bignumber/lib/bignumber");
const erc20Abi = [{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":
@james-turner
james-turner / json-to-glue-common.js
Last active July 29, 2020 15:33
Convert a json object example to cloudformation glue table column definition format [CAVEAT: data types are not perfect, you need a good value if you want the right type otherwise it defaults to string]
const fs = require('fs');
const cliArgs = process.argv.slice(2);
const data = fs.readFileSync(cliArgs[0], 'UTF-8');
const tree = JSON.parse(data);
const dfs = (todo, acc) => {
if(todo.length === 0) return acc;
const [name, node] = todo[0];
todo = todo.slice(1);
<?php
/**
* SplClassLoader implementation that implements the technical interoperability
* standards for PHP 5.3 namespaces and class names.
*
* http://groups.google.com/group/php-standards/web/final-proposal
*
* // Example which loads classes for the Doctrine Common package in the
* // Doctrine\Common namespace.