Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am saurfang on github.
  • I am saurfang86 (https://keybase.io/saurfang86) on keybase.
  • I have a public key ASC6o2FrmLXuQC429VAJuUzvrfA1Gi_i4Me6h-MyiuYJqgo

To claim this, I am signing this object:

// address of deployed contract
var contractAddress = '0xDd56dCD052548Ac005563f42d13B4D502deCd379';
// get storage at slot 0
var storageAt0;
web3.eth.getStorageAt(contractAddress, 0, (err, res) => {
// convert to uint
console.log(`0: uint8: ${web3.toDecimal(res)}`);
});
@saurfang
saurfang / app.R
Last active May 8, 2019 22:53
Selectize Plugins in Shiny
library(htmltools)
addUIDep <- function(x) {
jqueryUIDep <- htmlDependency("jqueryui", "1.10.4", c(href="shared/jqueryui/1.10.4"),
script = "jquery-ui.min.js",
stylesheet = "jquery-ui.min.css")
attachDependencies(x, c(htmlDependencies(x), list(jqueryUIDep)))
}
@saurfang
saurfang / count
Last active May 14, 2018 19:29
devtools::update_packages install packages multiple times
grep 'DONE ' update_packages.log | sort | uniq -c | sort -bgr
9 * DONE (rlang)
7 * DONE (withr)
3 * DONE (scales)
3 * DONE (pkgbuild)
2 * DONE (rcmdcheck)
2 * DONE (pkgload)
2 * DONE (ggplot2)
1 * DONE (tidyjson)
1 * DONE (plotly)
pragma solidity ^0.4.21;
contract Miner {
uint public blockNumber;
uint public blocks;
function Miner() public {
reset();
}
const PredictTheFutureChallenge = artifacts.require('PredictTheFutureChallenge');
const PredictTheFutureSolver = artifacts.require('PredictTheFutureSolver');
contract('PredictTheFutureSolver', ([account]) => {
it('should solve the challenge', async () => {
let challenge = await PredictTheFutureChallenge.new({value: web3.toWei(1, 'ether')});
let solver = await PredictTheFutureSolver.new();
let guess = 0;
await solver.lockInGuess(challenge.address, guess, {value: web3.toWei(1, 'ether')});
pragma solidity ^0.4.21;
import "./GuessTheNewNumberChallenge.sol";
contract GuessTheNewNumberSolver {
address owner;
function GuessTheNewNumberSolver() public {
owner = msg.sender;
}
const GuessTheNewNumberChallenge = artifacts.require('GuessTheNewNumberChallenge');
const GuessTheNewNumberSolver = artifacts.require('GuessTheNewNumberSolver');
contract('GuessTheNewNumberSolver', ([account]) => {
it('should solve the challenge', async () => {
let challenge = await GuessTheNewNumberChallenge.new({value: web3.toWei(1, 'ether')});
let solver = await GuessTheNewNumberSolver.new();
await solver.guess(challenge.address, {value: web3.toWei(1, 'ether')});
const GuessTheNewNumberChallenge = artifacts.require('GuessTheNewNumberChallenge');
const GuessTheNewNumberSolver = artifacts.require('GuessTheNewNumberSolver');
contract('GuessTheNewNumberSolver', ([account]) => {
it('should solve the challenge', async () => {
let challenge = await GuessTheNewNumberChallenge.new({value: web3.toWei(1, 'ether')});
let solver = await GuessTheNewNumberSolver.new();
assert(
await solver.isComplete(challenge.address) === true,
const GuessTheNewNumberChallenge = artifacts.require('GuessTheNewNumberChallenge');
contract('GuessTheNewNumberChallenge', ([account]) => {
it('should be completed', async () => {
let challenge = await GuessTheNewNumberChallenge.new({value: web3.toWei(1, 'ether')});
assert(
await challenge.isComplete() === true,
'Challenge has not been completed!'
);