Skip to content

Instantly share code, notes, and snippets.

View adamstallard's full-sized avatar
🪁

Adam Stallard adamstallard

🪁
View GitHub Profile
import { Parser as parser } from 'expr-eval';
import _ from 'lodash';
let verifications = [
{
"name": "Aura",
"user": "abc",
"block": 33340560,
"timestamp": 1756518949006,
"domains": [
@adamstallard
adamstallard / LockedLiquidity.sol
Last active February 7, 2025 02:31
Locked Uniswap V4 Liquidity (can still withdraw fees)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// Import OpenZeppelin's Ownable and ERC-20 libraries
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
// Import the Uniswap V4 Position Manager Interface
import "./IPositionManager.sol";
@adamstallard
adamstallard / shortNum.js
Created January 14, 2025 04:52
Shorten numbers with precision and suffixes
function shortNum(n, p=3, e=p-3) {
if (n === 0) return '0';
let ans;
const absn = Math.abs(n);
if (absn < Math.pow(10, -1 * p) || absn >= 10 ** 18 ){
ans = Number.parseFloat(n).toExponential(Math.max(e, 0));
}
else if (absn < 1){
@adamstallard
adamstallard / my-app.ts
Last active January 11, 2025 00:13
Dark mode switch Lit
@state()
private _isDarkMode = this._getInitialTheme();
private _getInitialTheme(): boolean {
const storedTheme = localStorage.getItem('theme');
if (storedTheme) {
return storedTheme === 'dark';
} else {
return window.matchMedia('(prefers-color-scheme: dark)').matches;
}
@adamstallard
adamstallard / OnchainMedianVote.md
Last active December 19, 2024 15:52
Keeping a running median vote on chain
This post links my 3Box profile to my Github account! Web3 social profiles by 3Box.
✅ did:3:bafyreigz63l2hwf3x37f27sp3ytordn2syx2ggclm6pt4jqb7rcho3iyfq ✅
Create your profile today to start building social connection and trust online at https://3Box.io/

Keybase proof

I hereby claim:

  • I am adamstallard on github.
  • I am castall (https://keybase.io/castall) on keybase.
  • I have a public key ASCtqtasKKz9kJDOLUgdQeZDqnTPQ46bWseR4fnFpu59Ewo

To claim this, I am signing this object:

Coinsensus

Coinsensus is a token that's regularly minted and distributed according to near-consensus of a voting group with a growing or fluctuating membership.

Others may contribute to the mission of an instance of the token by donating other tokens, including ether.

Holders of the token may receive dividends from the donated tokens.

Particulars

Near-consensus is required among those that vote each round, but there's no requirement of quorum.

@adamstallard
adamstallard / attr-string-template-pre.xhtml
Last active August 26, 2023 10:50
How to reuse part of an attribute string in modest.
<?xml version='1.0' encoding='UTF-8'?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<include>myImage</include>
</head>
<body>
<myImage>
<base>..</base>
</myImage>
</body>
@adamstallard
adamstallard / greetings\hello.xml
Last active December 21, 2015 23:39
Include a module from a different directory with the "path" attribute
<p>Hello, World!</p>