Skip to content

Instantly share code, notes, and snippets.

View rsoury's full-sized avatar
🍓
Foraging Berries

Ryan Soury rsoury

🍓
Foraging Berries
View GitHub Profile
@rsoury
rsoury / functions.php
Last active November 12, 2020 10:30 — forked from jchristopher/functions.php
Integrate Flatsome's live search with SearchWP
<?php
/**
* Standalone function used by Flatesome Search Filter
*
* @param string $search_query
* @param array $args
* @param array $defaults
* @return array
*/
@rsoury
rsoury / env-plugin-manager.php
Created November 12, 2020 13:43
Environment based Plugin Activation for Wordpress Bedrock. Use as a mu-plugin.
<?php
/**
* @package env-plugin-manager
* @version 1.0
*
* Plugin Name: Environment Plugin Manager
* Description: This plugin manages the activation of other plugins based on the website's environment
* Version: 1.0
* Author: Ryan Soury | Web Doodle
@rsoury
rsoury / 3id-arweave-auth-provider.ts
Created May 21, 2022 14:15
CAIP10 Auth Provider for Arweave Wallets
import {
AuthProvider,
asOldCaipString,
getConsentMessage,
LinkProof
} from "@ceramicnetwork/blockchain-utils-linking";
import { AccountId } from "caip";
import * as uint8arrays from "uint8arrays";
export class ArweaveAuthProvider implements AuthProvider {
@rsoury
rsoury / GetClosestBlockByTime.ts
Last active April 12, 2023 10:35
Get Closest EVM Block By Time
import { ethers } from 'ethers';
// Inspired by: https://medium.com/@hanyi.lol/how-to-get-a-block-number-by-timestamp-fefde4c69162
export async function getClosestBlockByTime(
timestamp: number,
provider: ethers.Provider
) {
let maxBlockNumber = await provider.getBlockNumber();
let minBlockNumber = 0;
const maxBlock = await provider.getBlock(maxBlockNumber);