den@den-vb:~/projects$ iex fsm.ex
Erlang/OTP 20 [erts-9.3.1] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:10] [hipe] [kernel-poll:false]
Interactive Elixir (1.7.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> Fsm.transition!(%{status: "draft", data: "payload"}, :rejected)
%{data: "payload", status: "rejected"}
iex(2)> Fsm.transition!(%{status: "rejected", data: "payload"}, :signed)
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
#!/bin/sh | |
# | |
# Place in .git/hooks and make executable | |
MIX_LOCATION=mix | |
cd `git rev-parse --show-toplevel` | |
$MIX_LOCATION format --check-formatted |
Got code here: https://www.ethereum.org/greeter
Got some info from this page: https://ethereum.stackexchange.com/questions/3256/how-do-i-find-out-the-solidity-compiler-version-i-am-using
Comments removed, constructor removed.
Published here: https://rinkeby.etherscan.io/verifyContract?a=0x03aafff2181174ac8d9ebc6a0c2c3efbb58548dc
With comments, same result, no problems.
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
uint saleTime = period * 1 days; | |
if(now < start + saleTime.div(4)) { | |
bonusTokens = tokens.div(4); | |
} else if(now >= start + saleTime.div(4) && now < start + saleTime.div(2)) { | |
bonusTokens = tokens.div(10); | |
} else if(now >= start + saleTime.div(2) && now > saleTime.div(4).mul(3)) { | |
bonusTokens = tokens.div(20); | |
} |
Following instructions from the excellent https://www.rinkeby.io/
A full node lets you access all state. There is a light node (state-on-demand) and wallet-only (no state) instructions as well,
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> So.Exclude.exclude1 | |
Name ips average deviation median | |
substract 9.18 M 0.109 μs ±358.78% 0.100 μs | |
mapset_difference 4.00 M 0.25 μs ±17781.86% 0.0 μs | |
enum_filter 3.70 M 0.27 μs ±1712.25% 0.20 μs | |
ordsets 2.63 M 0.38 μs ±1348.35% 0.30 μs | |
Comparison: | |
substract 9.18 M | |
mapset_difference 4.00 M - 2.30x slower |
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 New do | |
def sum(a, b) do | |
a + b | |
end | |
end |
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
#!/bin/bash | |
# Called by "git push" after it has checked the remote status, | |
# but before anything has been pushed. | |
# | |
# If this script exits with a non-zero status nothing will be pushed. | |
# | |
# Steps to install, from the root directory of your repo... | |
# 1. Copy the file into your repo at `.git/hooks/pre-push` | |
# 2. Set executable permissions, run `chmod +x .git/hooks/pre-push` |
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
#user nobody; | |
#Defines which Linux system user will own and run the Nginx server | |
worker_processes 1; | |
#Referes to single threaded process. Generally set to be equal to the number of CPUs or cores. | |
#error_log logs/error.log; #error_log logs/error.log notice; | |
#Specifies the file where server logs. |
NewerOlder