Skip to content

Instantly share code, notes, and snippets.

@noman-land
noman-land / Queue.js
Created December 21, 2017 06:13
Linked List implementation of a queue
function LinkNode(value, prev = null, next = null) {
this.value = value;
this.prev = prev;
this.next = next;
}
function Queue() {
this.head = null;
this.tail = null;
function getRandom(max = 1) {
return Math.floor((Math.random() * max));
}
function Encoder(data) {
this.data = data;
this.dataLength = data.length;
this.makePacket = () => {
let result = 0;
pragma solidity ^0.4.18;
contract Payroll {
uint256 public constant ONE_MONTH = 30 * 24 * 60 * 60;
address public owner;
address public exchangeOracle;
modifier ownerOnly() {
require(msg.sender == owner);
pragma solidity ^0.4.11;
contract TaxAuthority {
address public owner;
mapping (address => uint) public taxesCollected;
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
pragma solidity ^0.4.11;
contract Interviewer {
address public answerer;
address public asker;
function Interviewer(address _asker, address _answerer) {
asker = _asker;
answerer = _answerer;
}
pragma solidity ^0.4.11;
contract AnsweringMachine {
enum Status {
Here,
Busy,
Away
}
struct AwayStatus {
pragma solidity ^0.4.11;
contract DMail {
address owner;
function DMail() public {
owner = msg.sender;
}
struct Message {
pragma solidity ^0.4.11;
contract Wiki {
function Wiki() {
}
struct Diff {
address owner;
uint currentSwarmHash;
pragma solidity ^0.4.10;
contract ReLike {
function ReLike() {
}
enum Rating {
UNRATED,
LIKE,
DISLIKE
@noman-land
noman-land / MultiplayerGame.sol
Last active April 1, 2018 22:54
Generic mutiplayer game contract for complex games to inherit from.
pragma solidity ^0.4.21;
contract MultiplayerGame {
uint[3] public SEMVER = [0, 1, 0];
uint public numGames;
enum ListType {
None,
Whitelist,
Blacklist