Skip to content

Instantly share code, notes, and snippets.

@visualzhou
visualzhou / gist:3347849
Created August 14, 2012 09:37
Douban Cross-domain Ajax
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<div id="images">
</div>
<script>
// A single wrapper method for all the instrumentation functions
def withInstrumentation[T](f: => Future[T], fallback: T, duration: Long = 5000): Future[T] = {
withErrorHandling(
withTimeout(withTiming(f), duration, fallback),
fallback
)
}
val myFuture = withInstrumentation(someAsyncIO(), "fallback value")
@jjkoshy
jjkoshy / gist:3842975
Created October 5, 2012 23:04
zkserializer
client.setZkSerializer(new ZkSerializer() {
@Override
public byte[] serialize(Object o)
throws ZkMarshallingError
{
return ZKStringSerializer.serialize(o);
}
@Override
public Object deserialize(byte[] bytes)
more readable format
pragma solidity ^0.4.24;
interface FoMo3DlongInterface {
function airDropTracker_() external returns (uint256);
function airDropPot_() external returns (uint256);
function withdraw() external;
}
@p0n1
p0n1 / badERC20Token.txt
Created June 8, 2018 12:21
This table is only intended for DAPP developer's reference, please pay attention to all the smart contracts listed and try your best to avoid the incompatibility, especially if you are working with one of them.
## badERC20 Token with code from etherum-org
0xcc2ae7ad8f32ea3bd38d0192d20e465503ae698d_TokenERC20.sol
0x5fe56bfa37217bd8a2879c15c85ed7a894edf5a6_esportz.sol
0x7E42c72DFbE07Cde83a6BaD535A1A97496Df1531_TokenERC20.sol
0xf175C958aFdBF91a0c1981FF0510fCAA87D71899_GeneticHealthToken.sol
0x0d9a3739f7e072e7562f6e2440f37ad9bee68c4a_TokenERC20.sol
0x6e77c68404cb4b86b1cf7ae4ade8d260b4f9d5ce_UlordToken.sol
0xbeebcfe2fbb3c72884341be2b73ae0fc6559b8fc_Q1SToken.sol
0x9d5e22b6599c426b453de4a43df8a0cb4de061b1_YAKcoinERC20.sol
@muuki88
muuki88 / jenkins-sbt.groovy
Created November 2, 2016 17:03
Jenkins 2.0 SBT build pipeline
node {
stage('Git') {
git 'https://github.com/muuki88/activator-play-cluster-sample.git'
}
stage('Build') {
def builds = [:]
builds['scala'] = {
// assumes you have the sbt plugin installed and created an sbt installation named 'sbt-0.13.13'
sh "${tool name: 'sbt-0.13.13', type: 'org.jvnet.hudson.plugins.SbtPluginBuilder$SbtInstallation'}/bin/sbt compile test"
}
@decanus
decanus / Issue.md
Last active September 5, 2019 18:01

With Solidity 0.4.23 a require statement seemingly fail if a contract called has a returndatasize of less than 32. This issue was found when wrapping a transferFrom function call, which doesn't return anything, in a require.

Older contracts that use STOP to return control flow place 1 on the stack through the return of CALL and so RETURNDATASIZE is set to 0. The new require seems to enforce that at least 32 bytes must be returned by the child contract (with RETURNDATASIZE >= 0x20) which seems to break old contracts that simply check whether the return of CALL itself was 1.

The token contract used is Adex.

This issue indicates that any token transfered without a return will fail, affecting any contract using tokens transfers that are wrapped in a require as of solidity v0.4.23

To ensure this really is an issue, we have tried running the code with 2 solidity versions. Essentially wrapping

pragma solidity 0.4.19;
import { SafeMath } from "zeppelin-solidity/contracts/math/SafeMath.sol";
import { ERC20 } from "zeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import { Exchange } from "../shared/Exchange.sol";
import { Proxy } from "../shared/Proxy.sol";
import { MathHelpers } from "../lib/MathHelpers.sol";
/**
* @title CoveredOption