Skip to content

Instantly share code, notes, and snippets.

View Hazelwu2's full-sized avatar

Hazel Wu Hazelwu2

View GitHub Profile
@Hazelwu2
Hazelwu2 / BuyMeACoffee.sol
Last active April 18, 2023 15:09
Buy Me A Coffee
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.18;
contract BuyMeACoffee {
uint256 totalCoffee;
address payable public owner;
constructor() payable {
owner = payable(msg.sender);
}
@Hazelwu2
Hazelwu2 / app.scss
Last active March 25, 2023 11:38
React Photo Search App.scss
body {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
font-family: sans-serif;
}
h1 {
color: coral;
}
@Hazelwu2
Hazelwu2 / App.css
Created March 18, 2023 10:52
Demo-React-TodoList-Css
@import url("https://fonts.googleapis.com/css2?family=Fira+Sans:wght@700&display=swap");
html {
height: 100%;
}
body {
font-family: "Noto Sans TC";
width: 100%;
height: 100%;
@Hazelwu2
Hazelwu2 / api.ts
Created February 27, 2023 09:46
Axios based Next js client and server side token refresher
import axios, { AxiosError } from "axios";
import { GetServerSidePropsContext } from "next";
import Router from "next/router";
const isServer = () => {
return typeof window === "undefined";
}
let accessToken = "";
let context = <GetServerSidePropsContext>{};
@Hazelwu2
Hazelwu2 / laravel-queue-worker.pm2.yml
Created February 14, 2023 10:08 — forked from vector-kerr/laravel-queue-worker.pm2.yml
Laravel Queue Worker PM2 Application Definition
#
# This file provides an application definition that can be used with
# PM2 ("Production Process Manager").
#
# PM2 "allows you to keep applications alive forever, to reload them
# without downtime and to facilitate common system admin tasks."
#
# Use this file by running it with PM2. For example:
# $> pm2 start laravel-queue-worker.pm2.yml
#
@Hazelwu2
Hazelwu2 / deploy.yml
Created September 15, 2022 19:07 — forked from LeCoupa/deploy.yml
Github Action Deploy Script For Nuxt.js ssh
name: Deploy
on:
push:
branches:
- production
jobs:
deploy:
runs-on: ubuntu-latest
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/[email protected]/token/ERC721/ERC721.sol";
import "@openzeppelin/[email protected]/access/Ownable.sol";
import "@openzeppelin/[email protected]/utils/Counters.sol";
contract KryptoCampBlindBoxNft is ERC721, Ownable {
using Counters for Counters.Counter;
using Strings for uint256;
@Hazelwu2
Hazelwu2 / easy-erc20.sol
Created August 20, 2022 02:43
基本題二 部署 ERC20
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract HazelToken is ERC20 {
// 調整 mint 數量,確定能夠拿到 10,000 個 ERC20 Token
uint256 public initialSupply = 10000;
// 嘗試修改 name 與 symbol
@Hazelwu2
Hazelwu2 / HazelNFT.sol
Created August 20, 2022 01:52
基本題ERC20
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
contract HazelNFT is ERC721 {
// TODO: 改掉 name, symbol
constructor() ERC721("HazelNFT", "HZ") {}
function mint(uint256 tokenId) public {
@Hazelwu2
Hazelwu2 / ERC20Rug.sol
Created August 17, 2022 14:35
RugPullToken 騙 ERC20 合約
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract RugPullToken is ERC20 {
constructor(uint256 initialSupply) ERC20("Rug Pull", "RP") {
}