Skip to content

Instantly share code, notes, and snippets.

View danielkhoo's full-sized avatar
📚

Daniel danielkhoo

📚
View GitHub Profile
pragma solidity >=0.8.0 <0.9.0;
/**
* @notice Function for players to commit their choice
* @dev players can commit multiple times to change their choice until the other player commits
* @param choice - "rock", "paper" or "scissors"
* @param salt - a player chosen secret string used to "salt" the commit hash
*/
function commit(string memory choice, string memory salt)
public
validGameState(activeGame[msg.sender], GameState.CommitPhase)
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,
"Arrow Function": {
"prefix": "arfn",
"body": [
"const $1 = () => {",
"return ",
"};",
"$2"
],
"description": "Arrow Function"
}
"Fat Console Log": {
"prefix": "clgf",
"body": [
"console.log('\\n\\n\\nhellothere\\n',$1,'\\n\\n\\n');",
"$2"
],
"description": "Fat Console Log"
},
@danielkhoo
danielkhoo / default
Created August 31, 2018 10:30
Nginx Proxy for Node
server_name mynewsite.com www.mynewsite.com;
location / {
#----------Add this section-----------
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:3000;
proxy_redirect off;
@danielkhoo
danielkhoo / Dockerfile
Created August 30, 2018 10:02
Dockerfile for Node
FROM node:8-alpine
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY . .
RUN npm install
EXPOSE 3000
CMD [ "node", "server.js" ]