Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
const path = require('path'); | |
const fs = require('fs'); | |
const solc = require('solc'); | |
const source = fs.readFileSync(bigGamePath, 'utf8'); | |
const HDWalletProvider = require('truffle-hdwallet-provider'); | |
const Web3 = require('web3'); | |
const { MNEMONIC, INFURA_HOST } = process.env; | |
const provider = new HDWalletProvider(MNEMONIC, INFURA_HOST); | |
const web3 = new Web3(provider); |
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
it('allows an account to enter', async () => { | |
await lottery.methods.enter().send({ | |
from: accounts[0], | |
value: web3.utils.toWei('0.015', 'ether'), | |
}); | |
const players = await lottery.methods.players().call({ | |
from: accounts[0], | |
}); | |
const balance = await lottery.methods.getBalance().call({ |
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.18; | |
contract Inbox { | |
string public message; | |
function Inbox(string initialMessage) public { | |
message = initialMessage; | |
} | |
function setMessage(string newMessage) public { |
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
iex> ExStatsTracker.counter(your_key, 1) | |
iex> ExStatsTracker.increment(your_key) | |
iex> ExStatsTracker.gauge(your_key) | |
iex> ExStatsTracker.timing(your_metric, 1) | |
iex> ExStatsTracker.histogram(your_metric, 1) | |
iex> ExStatsTracker.meter(your_metric, 1) |
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
config :ex_stats_tracker, | |
host: “your.statsd.host.com”, | |
port: 1234, | |
prefix: “your_prefix” | |
flush_interval: 10000 | |
chunk_size: 20 |
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
iex> ConsulMutEx.lock(“test_key”, max_retries: 0) do | |
...> :acquired | |
...> else | |
...> :failed_to_acquire | |
...> end | |
:acquired |
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
defmodule ConsulMutEx.Backends.ConsulBackend do | |
@moduledoc """ | |
Use Hashicorp's Consul KV store to acquire and release locks. | |
[Consul documentation](https://www.consul.io/docs/agent/http/kv.html) | |
""" | |
alias Consul.Session | |
@timeout 1000 |
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
# Atom settings |
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
from postmates import PostmatesAPI, DeliveryQuote, Delivery, Location, PostmatesAPIException | |
key = '[redacted]' | |
customer_id = '[redacted]' | |
api = PostmatesAPI(key, customer_id) | |
pickup = Location('Gather Food LLC', '1440 S. Jackson Street, Seattle, WA', '574-551-2847') | |
dropoff = Location('Bob', '1040 S. Jackson Street, Seattle, WA', '415-777-9999') | |
quote = DeliveryQuote(api, pickup.address, dropoff.address) |
NewerOlder