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 function handler(req, res) { | |
// getPosts is a fn that returns all the posts, you should already have this for a markdown/mdx site | |
const posts = getPosts(); | |
res.statusCode = 200 | |
res.setHeader('Content-Type', 'text/xml') | |
// Instructing the Vercel edge to cache the file | |
res.setHeader('Cache-control', 'stale-while-revalidate, s-maxage=3600') | |
// generate sitemap here |
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 { ImageResponse } from '@vercel/og' | |
export const config = { | |
runtime: 'edge', | |
} | |
export default async function handler(req) { | |
const HOST = 'https://danielkhoo.xyz' | |
const { searchParams } = req.nextUrl | |
const title = searchParams.get('title') || 'danielkhoo.xyz' | |
const description = searchParams.get('description') || `Hello there! I'm Daniel. Welcome to my online home for ideas, writing and side projects.` |
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
<!-- OpenGraph Meta Tags --> | |
<meta name="twitter:card" content="summary" /> | |
<meta name="twitter:creator" content="@jadenkore" /> | |
<meta property="twitter:domain" content="danielkhoo.xyz" /> | |
<meta property="twitter:url" content="https://danielkhoo.xyz/twitter-and-open-graph-cards" /> | |
<meta name="twitter:title" content="Twitter and OpenGraph Cards" /> | |
<meta name="twitter:description" content="Having a personal site is great for standing out and expressing your creativity..." /> | |
<meta name="twitter:image" content="https://danielkhoo.xyz/sd2.png" /> | |
<!-- OpenGraph Meta Tags --> | |
<meta property="og:url" content="https://danielkhoo.xyz/" /> |
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.0 <0.9.0; | |
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; | |
import "@openzeppelin/contracts/utils/Counters.sol"; | |
/** | |
* @title Digital Collectible | |
* @author Daniel Khoo | |
* @notice A dynamic NFT wrapper for digital collectibles on Instagram / Twitter with editable token URI |
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
{ | |
"name": "Digital Collectible Wrapper", | |
"description": "A dynamic wrapper NFT for linking Digital Collectibles on Instagram and Twitter", | |
"image": "https://github.com/danielkhoo.png" | |
} |
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 PACKAGE = "nric" | |
let widget = await createWidget(); | |
// Check where the script is running | |
if (config.runsInWidget) { | |
// Runs inside a widget so add it to the homescreen widget | |
Script.setWidget(widget); | |
} else { | |
// Show the medium widget inside the app |
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 API_KEY = "" // Add your etherscan API KEY here | |
let widget = await createWidget(); | |
// Check where the script is running | |
if (config.runsInWidget) { | |
// Runs inside a widget so add it to the homescreen widget | |
Script.setWidget(widget); | |
} else { | |
// Show the medium widget inside the app |
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.0 <0.9.0; | |
import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; | |
import "@openzeppelin/contracts/utils/Strings.sol"; | |
import "@openzeppelin/contracts/utils/Base64.sol"; | |
/** | |
* @title BuidlGuidl Tabard | |
* @author Daniel Khoo |
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
pragma solidity >=0.8.0 <0.9.0; | |
//SPDX-License-Identifier: MIT | |
contract RockPaperScissors { | |
// 4 Game Phases: Join, Commit, Reveal, Result | |
enum GameState { | |
JoinPhase, | |
CommitPhase, | |
RevealPhase, |
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
pragma solidity >=0.8.0 <0.9.0; | |
/** | |
* @notice Function for players to reveal their choice. The first player to reveal sets a deadline for the second player | |
* this is prevent players for abandoning the game once they know they have lost based on the revealed hash. | |
* At the end of the deadline, the player who committed can trigger a "win-by-default". | |
* If both players reveal in time, the second player's reveal will call determineWinner() and advance the game to the result phase | |
* @notice Unlike commit, players can only reveal once | |
* @param salt - a player chosen secret string from the "commit" phase used to prove their choice via a hash match | |
*/ |
NewerOlder