Skip to content

Instantly share code, notes, and snippets.

View alexvandesande's full-sized avatar
🤖
Preventing human machine conflicts

Alex Van de Sande alexvandesande

🤖
Preventing human machine conflicts
View GitHub Profile
var base10 = $('input[id="base10"]').numeric({ negative: false });
function syllable(n){
consonants = 'bcdfghjklmnprstvwz'; // consonants except hard to speak ones
vowels = 'aeiou'; // vowels
all = consonants + vowels; // all
text = '';
syllableStr = "";
if (n<90) {
contract owned {
address public owner;
function owned() {
owner = msg.sender;
}
modifier onlyOwner {
if (msg.sender != owner) throw;
_
}
function transferOwnership(address newOwner) onlyOwner {
contract tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData); }
contract MyToken {
/* Public variables of the token */
string public name;
string public symbol;
uint8 public decimals;
/* This creates an array with all balances */
mapping (address => uint256) public balanceOf;
/*
Foundation Tip Contract
Address: 0xfb6916095ca1df60bb79ce92ce3ea74c37c5d359
Bitcoin Shapeshift Address: 1GyczDXWjFbmhx2Qau4ham3zJqNEP8UcEG (if transaction fails it is sent to 39BaMQCphFXyYAvcoGpeKtnptLJ9v6cdFY instead)
Interface: [{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"proposals","outputs":[{"name":"recipient","type":"address"},{"name":"amount","type":"uint256"},{"name":"description","type":"string"},{"name":"votingDeadline","type":"uint256"},{"name":"executed","type":"bool"},{"name":"proposalPassed","type":"bool"},{"name":"numberOfVotes","type":"uint256"},{"name":"currentResult","type":"int256"},{"name":"proposalHash","type":"bytes32"}],"type":"function"},{"constant":false,"inputs":[{"name":"proposalNumber","type":"uint256"},{"name":"transactionBytecode","type":"bytes"}],"name":"executeProposal","outputs":[{"name":"result","type":"int256"}],"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"memberId","outputs":[{"name":"","type":"uint
@alexvandesande
alexvandesande / Random generator
Last active December 23, 2022 09:10
A very simple random generator. A miner can influence the number by not publishing a block with an unwanted outcome, and forfeiting the 5 block reward.
contract random {
/* Generates a random number from 0 to 100 based on the last block hash */
function randomGen(uint seed) constant returns (uint randomNumber) {
return(uint(sha3(block.blockhash(block.number-1), seed ))%100);
}
/* generates a number from 0 to 2^n based on the last n blocks */
function multiBlockRandomGen(uint seed, uint size) constant returns (uint randomNumber) {
uint n = 0;
for (uint i = 0; i < size; i++){
Address:
0x85935ee5773319756973cfd8ce5d3eb5831827ce
ABI:
[ { "constant": true, "inputs": [ { "name": "", "type": "uint256", "typeShort": "uint", "bits": "256", "displayName": "", "template": "elements_input_uint" } ], "name": "proposals", "outputs": [ { "name": "recipient", "type": "address", "value": "0xd1220a0cf47c7b9be7a2e6ba89f429762e7b9adb", "displayName": "recipient" }, { "name": "amount", "type": "uint256", "value": "10", "displayName": "amount" }, { "name": "description", "type": "string", "value": "Refund 10 ethers to Avsa as a test of the DAO", "displayName": "description" }, { "name": "votingDeadline", "type": "uint256", "value": "1454093006", "displayName": "voting Deadline" }, { "name": "executed", "type": "bool", "value": true, "displayName": "executed" }, { "name": "proposalPassed", "type": "bool", "value": true, "displayName": "proposal Passed" }, { "name": "numberOfVotes", "type": "uint256", "value": "1", "displayName": "number Of Votes" }, { "name": "currentResult", "type": "int256", "valu
@alexvandesande
alexvandesande / Blockchain Congress
Created January 27, 2016 18:10
The way this particular democracy works is that it has an *Owner** which works like an administrator, CEO or a President. The *Owner* can add (or remove) voting members to the organization. Any member can make a proposal, which is in the form of an ethereum transaction to either send ether or execute some contract and other members can vote in s…
contract owned {
address public owner;
function owned() {
owner = msg.sender;
}
modifier onlyOwner {
if (msg.sender != owner) throw;
_
@alexvandesande
alexvandesande / How to interact with the Dogecoin Bounty DAO
Created December 29, 2015 12:00
This is a contract that manages bounties donated by the community to be donated to people who worked sucessfully on projects related to dogecoin-ethereum integration. It's a member vote.
This is a contract that manages bounties donated by the community to be donated to people who worked sucessfully on
projects related to dogecoin-ethereum integration. It's a member vote.
1) Download the latest Ethereum Wallet: https://github.com/ethereum/mist/releases/tag/0.3.7
2) Open it, let it sync and then create a new account
3) If you don't have any ether and isn't a member of the DAO, contact alex: avsa@ethdev.
4) Go to the 'contracts' tab and then 'watch contract'. Add the address and interface abi of the contract as shown here: https://gist.github.com/alexvandesande/eb6935702e2549d1e510
Address: 0xdbf03b407c01e7cd3cbea99509d93f8dddc8c6fb
ABI:
[ { "constant": true, "inputs": [ { "name": "", "type": "uint256", "typeShort": "uint", "bits": "256", "displayName": "", "template": "elements_input_uint", "value": "" } ], "name": "proposals", "outputs": [ { "name": "recipient", "type": "address" }, { "name": "amount", "type": "uint256" }, { "name": "description", "type": "string" }, { "name": "votingDeadline", "type": "uint256" }, { "name": "executed", "type": "bool" }, { "name": "proposalPassed", "type": "bool" }, { "name": "numberOfVotes", "type": "uint256" }, { "name": "currentResult", "type": "int256" }, { "name": "proposalHash", "type": "bytes32" } ], "type": "function", "displayName": "proposals" }, { "constant": false, "inputs": [ { "name": "proposalNumber", "type": "uint256", "typeShort": "uint", "bits": "256", "displayName": "proposal Number", "template": "elements_input_uint" }, { "name": "transactionBytecode", "type": "bytes", "typeShort": "bytes", "bits": "", "displayName": "tra
Uses Mist Coin for voting: 0xf4eced2f682ce333f96f2d8966c613ded8fc95dd
Owns 100,000 Mist coins for further distribution of funds
ADDRESS:
0x8d554c6c1631e44706e502433f0f958287d9b8dc
INTERFACE: