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 | |
add_action('get_footer', function(){ | |
if (!class_exists('Bricks\Capabilities')) { | |
return; | |
} | |
if( !bricks_is_builder() ) return; | |
?> |
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
// Client editing disclaimer | |
function custom_admin_notice_with_logo() { | |
$user_id = get_current_user_id(); | |
if (get_user_meta($user_id, 'custom_notice_dismissed', true) !== 'yes') { | |
if (current_user_can('administrator') || current_user_can('editor') || current_user_can('author')) { | |
$nonce = wp_create_nonce('custom_notice_dismiss_nonce'); | |
$image_url = 'https://nerdrush.com/wp-content/uploads/2023/08/Nerd-Rush-Logo-Blue-2023.svg'; // External image URL | |
?> | |
<div class="notice notice-warning custom-notice" style="padding-top: 20px;"> | |
<img src="<?php echo esc_url( $image_url ); ?>" alt="Logo" style="width: 120px; display: block; margin-bottom: 10px;"> |
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
BEGIN:VCALENDAR | |
VERSION:2.0 | |
CALSCALE:GREGORIAN | |
BEGIN:VEVENT | |
SUMMARY:Access-A-Ride Pickup | |
DTSTART;TZID=America/New_York:20130802T103400 | |
DTEND;TZID=America/New_York:20130802T110400 | |
LOCATION:1000 Broadway Ave.\, Brooklyn | |
DESCRIPTION: Access-A-Ride to 900 Jay St.\, Brooklyn | |
STATUS:CONFIRMED |
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
#adminmenu [id*="menu-posts-"]{ | |
background-color: var(--bricks-color-primary); | |
} | |
#adminmenu [id*=menu-posts-] > a { | |
color: black; | |
} | |
#adminmenu [id*=menu-posts-] > a .wp-menu-image::before{ | |
color: black; | |
} |
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
/* | |
Next.js/Edge function method for hasing passwords | |
Using the Web API Crypto feature instead of | |
Built-in Node.js Crypto | |
*/ | |
export default async function pbkdf2(password, salt, iterations, keylen) { | |
const enc = new TextEncoder(); | |
const passwordBuffer = enc.encode(password); | |
const saltBuffer = enc.encode(salt); |
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
export default async function isValidURL(url, disallowedDomains) { | |
// Construct a regular expression pattern to match disallowed domains | |
const disallowedPattern = `^https?:\\/\\/(?:${disallowedDomains.join('|')})\\b`; | |
let disallowedRegex = new RegExp(disallowedPattern, 'i'); | |
// Regular expression pattern to match a URL (excluding localhost) | |
const urlPattern = /^(https?:\/\/)?((?!localhost)[\w.-]+)\.([a-z]{2,})(:\d{1,5})?(\/.*)?$/i; | |
let urlRegex = new RegExp(urlPattern); | |
// Test the URL against both URL pattern and disallowed domain pattern |
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
/* | |
MIT License | |
Copyright © Joel Whitaker | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
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
const stages = ['production', 'staging', 'development', 'test'] as const; | |
type Stage = typeof stages[number]; | |
function getStage(stages: Stage[]) { | |
if (!stages.length) return 'production'; | |
for (const stage of stages) { | |
// if any of the provided stages is production, assume we are in production | |
if (stage === 'production') { |
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 * as ethers from 'ethers'; | |
import { | |
ExternalProvider, | |
JsonRpcSigner, | |
Network, | |
Web3Provider | |
} from '@ethersproject/providers'; | |
import { useState } from 'react'; | |
declare global { |
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
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.4; | |
import "@openzeppelin/contracts@4.7.1/token/ERC721/ERC721.sol"; | |
import "@openzeppelin/contracts@4.7.1/access/Ownable.sol"; | |
import "@openzeppelin/contracts@4.7.1/utils/Counters.sol"; | |
contract MyToken is ERC721, Ownable { | |
using Counters for Counters.Counter; |
NewerOlder