This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Retrieve the whitelist object by ID | |
const whitelist = await client.getObject({ | |
id: "0x2cf9813bc67835218b09e0444b452cedb0aec96cc82283bdbac30e055dc76e82", | |
options: { showContent: true }, | |
}); | |
// Here is the content object from the query response | |
const whitelistContent: any = whitelist.data?.content; | |
// Check if there are entries in your table by its size |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { JsonRpcProvider } from "@mysten/sui.js"; | |
export function useGetObjects(provider: JsonRpcProvider) { | |
const getObjectsByType = ( | |
address: string | undefined, | |
type: string, | |
nextCursor: string = '' | |
): Promise<any> => { | |
// return an empty array for non-address. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get a space-separated string of publisher object IDs | |
PUBLISHER_IDS_STRING=$(echo "$newObjs" | jq -r 'select(.objectType | contains("::Publisher")).objectId') | |
# Read the Publishers string into an array using a while loop | |
declare -a PUBLISHERS | |
while IFS= read -r line; do | |
PUBLISHERS+=("$line") | |
done <<< "$PUBLISHER_IDS_STRING" | |
# Create a temporary file to hold the environment variables |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo sed -i 's/^\#.*$//g' PATH/FILE.EXTENSION && sudo sed -i '/^$/d' PATH/FILE.EXTENSION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function validURL(str) { | |
var pattern = new RegExp('^(https?:\\/\\/)?'+ // protocol | |
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+ // domain name | |
'((\\d{1,3}\\.){3}\\d{1,3}))'+ // OR ip (v4) address | |
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // port and path | |
'(\\?[;&a-z\\d%_.~+=-]*)?'+ // query string | |
'(\\#[-a-z\\d_]*)?$','i'); // fragment locator | |
return !!pattern.test(str); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# Takes an array as input | |
# Returns an array with the length, position and string of the longest value | |
function arrayLongestValue( $tmp = array() ) { | |
if( !empty($tmp) ){ | |
$lengths = array_map('strlen', $tmp); | |
$max_length = max($lengths); |