Skip to content

Instantly share code, notes, and snippets.

View HashRei's full-sized avatar
🐛
Bug hunting

Silvan Reigue HashRei

🐛
Bug hunting
View GitHub Profile
@HashRei
HashRei / ReferralRewards.sol
Created July 24, 2024 18:55
The first sketch of a Referral Rewards smart contract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract ReferralRewards is Ownable {
IERC20 public referralToken;
uint256 public rewardPerReferral;
mapping(address => uint256) public referralsCount;
@HashRei
HashRei / gist:2ddc942d8c9a23c6de03e9fda67a3a4e
Created November 27, 2023 13:12 — forked from levelsio/gist:5bc87fd1b1ffbf4a705047bebd9b4790
Secret of Monkey Island: Amsterdam (by @levelsio) or how to create your own ChatGPT image+text-based adventure game
# 2023-11-27 MIT LICENSE
Here's the open source version of my ChatGPT game MonkeyIslandAmsterdam.com.
It's an unofficial image+text-based adventure game edition of Monkey Island in Amsterdam, my home town.
Please use it however you want. It'd be nice to see more ChatGPT-based games appear from this. If you get inspired by it, please link back to my X https://x.com/levelsio or this Gist so more people can do the same!
Send me your ChatGPT text adventure game on X, I'd love to try it!
@HashRei
HashRei / _app.tsx
Created July 17, 2022 12:00
_app.tsx for next-theme integration with Tailwind CSS dark mode
import "../styles/globals.css";
import type { AppProps } from "next/app";
import { ThemeProvider } from "next-themes";
function MyApp({ Component, pageProps }: AppProps) {
return (
<ThemeProvider attribute="class">
<Component {...pageProps} />
</ThemeProvider>
);
@HashRei
HashRei / tailwind.config.js
Created July 17, 2022 11:59
Tailwind config file to handle dark mode
module.exports = {
content: [
"./pages/**/*.{js,ts,jsx,tsx}",
"./components/**/*.{js,ts,jsx,tsx}",
],
darkMode: "class",
theme: {
extend: {},
},
plugins: [],
@HashRei
HashRei / index.tsx
Last active July 17, 2022 12:08
index.tsx - hydration safe
import type { NextPage } from "next";
import Head from "next/head";
import { useTheme } from "next-themes";
import { useState, useEffect } from "react";
const Home: NextPage = () => {
return (
<div className="flex min-h-screen flex-col items-center justify-center py-2">
<Head>
<title>Create Next App</title>
@HashRei
HashRei / index.tsx
Last active July 17, 2022 12:03
index.tsx with useTheme hook - ⚠hydration unsafe
import type { NextPage } from "next";
import Head from "next/head";
import { useTheme } from "next-themes";
const Home: NextPage = () => {
return (
<div className="flex min-h-screen flex-col items-center justify-center py-2">
<Head>
<title>Create Next App</title>
<link rel="icon" href="/favicon.ico" />
@HashRei
HashRei / _app.tsx
Created July 17, 2022 08:44
_app.tsx for next-theme integration
import "../styles/globals.css";
import type { AppProps } from "next/app";
import { ThemeProvider } from "next-themes";
function MyApp({ Component, pageProps }: AppProps) {
return (
<ThemeProvider>
<Component {...pageProps} />
</ThemeProvider>
);