Skip to content

Instantly share code, notes, and snippets.

View recmo's full-sized avatar

Remco Bloemen recmo

View GitHub Profile
@recmo
recmo / faucet-contracts.sol
Created March 29, 2017 11:05
Facuet, Multiplexer and Manager
pragma solidity ^0.4.8;
import "../lib/Owned.sol";
import "../lib/SafeMath.sol";
// This contract can be used when a smart contract has a
// role that can be fullfilled by one account, but you would
// like several accounts to fullfill the role.
contract Multiplexer is Owned {
@recmo
recmo / async-fizzbuzz.js
Last active February 2, 2017 14:23
Async FizzBuzz — implemented using *only* callbacks
// Async FizzBuzz -- implemented using only callbacks
//
// node --stack-size=100000 ./async-fizzbuzz.js
//
// Wrap process.stdout.write
const print = (message, callback) =>{
process.stdout.write(message, callback)
}
pragma solidity ^0.4.0;
contract HexEncoding {
function hexEncodeTest(address addr) returns (bytes32 ret) {
uint x = uint(addr) / 2**32;
// Nibble interleave
x = x & 0x00000000000000000000000000000000ffffffffffffffffffffffffffffffff;
x = (x | (x * 2**64)) & 0x0000000000000000ffffffffffffffff0000000000000000ffffffffffffffff;