This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset='utf-8'> | |
<meta http-equiv='X-UA-Compatible' content='IE=edge'> | |
<meta name='viewport' content='width=device-width, initial-scale=1'> | |
<title>Web3 Snitch</title> | |
<style> | |
html, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function setup() { | |
frameRate(30) | |
} | |
const numParticles = 20 | |
const numGradientParts = 20 | |
let particles = | |
[...(new Array(numParticles)).keys()] | |
.map(i => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const isRNANucleotide = n => { | |
const lowerN = n.toLowerCase() | |
return ( | |
lowerN === 'a' || // adenine | |
lowerN === 'u' || // uracil | |
lowerN === 'c' || // cytosine | |
lowerN === 'g' // guanine | |
) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { | |
clip, | |
scale, | |
midi, | |
arp, | |
getChordsByProgression | |
} = require('scribbletune') | |
const progression = getChordsByProgression('d2 major', 'I VI ii V') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract MyERCToken { | |
// Create a table so that we can map addresses | |
// to the balances associated with them | |
mapping(address => uint256) balances; | |
// Owner of this contract | |
address public owner; | |
function balanceOf(address _owner) constant returns (uint256 balance) { | |
// Return the balance for the specific address | |
return balances[_owner]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.0; | |
// event Mint(address indexed from, uint reward_amount, uint epochCount, bytes32 newChallengeNumber); | |
// event Transfer(address indexed _from, address indexed _to, uint256 _value); | |
// event Approval(address indexed _owner, address indexed _spender, uint256 _value); | |
contract Metamine { | |
uint256 public constant MAX_TARGET = 2**256 - 1; | |
uint256 public constant totalSupply = 21000000; // max 21M tokens |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract ERC721 { | |
// ERC20 compatible functions | |
function name() constant returns (string name); | |
function symbol() constant returns (string symbol); | |
function totalSupply() constant returns (uint256 totalSupply); | |
function balanceOf(address _owner) constant returns (uint balance); | |
// Functions that define ownership | |
function ownerOf(uint256 _tokenId) constant returns (address owner); | |
function approve(address _to, uint256 _tokenId); | |
function takeOwnership(uint256 _tokenId); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.15; | |
contract MyERCToken { | |
// Create a table so that we can map addresses | |
// to the balances associated with them | |
mapping(address => uint256) balances; | |
// Create a table so that we can map | |
// the addresses of contract owners to | |
// those who are allowed to utilize the owner's contract | |
mapping(address => mapping (address => uint256)) allowed; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = require('request'); | |
function createTransaction(fromAddress, toAddress, amount, peerUrl){ | |
// Send a post request | |
request.post( | |
// ...to the provided url | |
peerUrl, | |
{ | |
// ...in JSON | |
json: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createWallet(){ | |
let privateKey = createPrivateKey(); | |
let publicKey = getPublicKey(privateKey); | |
let address = createAddress(publicKey); | |
return ({ | |
private: privateKey.toString('hex'), | |
public: publicKey.toString('hex'), | |
address: address | |
}); | |
} |