Skip to content

Instantly share code, notes, and snippets.

# Unity Cheatsheet
These are some helpful commands for navigating a scene in unity
- Hold right-click + WASD to fly around scene
- With a prefab and your mouse in the Scene view, Press F to focus on it
then use the scroll wheel to zoom in and out and hold the scroll wheel to pan
- Hold alt+left-click to rotate around the focal point or hold alt+right-click to zoom in and out
- If anything goes wrong, press Ctrl/Cmd+Z to Undo until it’s fixed
- ctrl-p enter/exit play mode
- qwerty keys select the move/rotate/etc tools
@cipherzzz
cipherzzz / Bet.sol
Created March 22, 2018 10:30
Re-Entrancy Security Vulnerability
...
function payout() public payable {
checkPermissions(msg.sender);
if (game.originator.status == STATUS_TIE && game.taker.status == STATUS_TIE) {
game.originator.addr.transfer(game.betAmount);
game.taker.addr.transfer(game.betAmount);
} else {
if (game.originator.status == STATUS_WINNER) {
@cipherzzz
cipherzzz / Bet.js
Last active February 10, 2018 15:46
...
constructor(props) {
super(props);
this.state = this.generateStateFromProps(props);
}
componentWillReceiveProps(newProps) {
if (newProps.bet !== this.props.bet) {
this.setState(this.generateStateFromProps(newProps));
@cipherzzz
cipherzzz / App.js
Last active February 10, 2018 15:50
...
class App extends Component {
constructor(props) {
super(props);
this.state = {
bet: {},
web3: null,
};
@cipherzzz
cipherzzz / testBet.js
Created January 11, 2018 16:33
Mocha Test for Bet.sol
var Bet = artifacts.require("./contracts/Bet");
const betAmountInEth = 0.25;
const wrongBetAmountInEth = 0.15;
const agreedUponBetAmount = web3.toWei(betAmountInEth, "ether");
const wrongBetAmount = web3.toWei(wrongBetAmountInEth, "ether");
contract("Bet", function(accounts) {
const betOriginator = accounts[0];
const betTaker = accounts[1];
@cipherzzz
cipherzzz / Bet.sol
Created January 11, 2018 16:25
Jedi Ethereum Betting Smart Contract
pragma solidity ^0.4.8;
contract Bet {
//jedi bet status
uint constant STATUS_WIN = 1;
uint constant STATUS_LOSE = 2;
uint constant STATUS_TIE = 3;
uint constant STATUS_PENDING = 4;
//game status