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; | |
contract SampleUpdater { | |
address authorized_service_provider; | |
uint nonce; | |
function getNonce() public view returns(uint) { | |
return nonce; | |
} | |
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
//sol Infinite8BitForLoop | |
// @authors | |
// Tim Cotten <tim@cotten.io> (https://blog.cotten.io) | |
// An example implementation of why not to trust `var i = 0` in for loops | |
// Input to the test function above 255 results in an infinite loop | |
pragma solidity ^0.4.0; | |
contract Infinite8BitForLoop { | |
function test(uint256 x) public pure returns(uint256) | |
{ | |
uint256 total = 0; |
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
#include <mysql.h> | |
#include <my_global.h> | |
// Note: TRUE and FALSE will always be defined by the MySQL headers | |
#define MYSQL_CONF_NUM 4 | |
#define MYSQL_CONF_HOSTNAME 0 | |
#define MYSQL_CONF_DATABASE 1 | |
#define MYSQL_CONF_USERNAME 2 | |
#define MYSQL_CONF_PASSWORD 3 |
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
do { | |
MYSQL_FIELD *fields; | |
MYSQL_BIND *rs_bind; | |
if (mysql_stmt_field_count(stmt) > 0) { | |
MYSQL_RES *rs_metadata = mysql_stmt_result_metadata(stmt); | |
fields = mysql_fetch_fields(rs_metadata); | |
rs_bind = (MYSQL_BIND *) malloc(sizeof (MYSQL_BIND)); | |
memset(rs_bind, 0, sizeof (MYSQL_BIND)); |
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 class="no-js" lang="en"> | |
<!-- | |
FlippyTime™ | |
Version: 1.1.0 | |
Copyright © 2017 Tim Cotten | |
Sound design by SoundJay.com (https://www.soundjay.com/) | |
--> |
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
<?php | |
/** | |
* Allows a given child class to behave as a Singleton without interfering | |
* with other child classes also using the Singleton behavior. | |
* | |
* @author Tim Cotten <tim@cotten.io> | |
* | |
* @abstract | |
*/ | |
abstract class AbstractSingleton |
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.22 <0.6.0; | |
contract DepositAccount { | |
address payable owner; | |
constructor() public { | |
owner = msg.sender; | |
} | |
function withdraw() public { | |
require(owner == msg.sender); |
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.22 <0.6.0; | |
contract DepositAccount { | |
address owner; | |
constructor() public { | |
owner = msg.sender; | |
} | |
function withdraw() public { | |
require(owner == msg.sender); |
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.22 <0.6.0; | |
contract DepositAccount { | |
address owner; | |
modifier onlyOwner() { | |
require(msg.sender == owner); | |
_; | |
} | |
modifier hasBalance(uint256 amount) { |
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.22 <0.6.0; | |
contract DepositAccount { | |
address private owner; | |
modifier onlyOwner() { | |
require(msg.sender == owner); | |
_; | |
} | |
modifier withMinBalance(uint256 amount) { |
OlderNewer