For MVP initial version:
- must support basic programming logic, math, functions, variables, collections etc
- must support json - encoding / decoding / traversal
- must have http client capability
- must have crypto capability, openssl
| result = repo.user.findByEmail(user.value["email"]) | |
| p typeof(result.value) #(Iterator::Stop | RethinkDB::QueryResult | String) | |
| p result.value.is_a?(RethinkDB::QueryResult) #true | |
| result.should be_a(DB::Success(RethinkDB::QueryResult)) # fails with error below | |
| Failures: | |
| 1) Repository Repository::User should find a user by email | |
| Failure/Error: result.should be_a(DB::Success(RethinkDB::QueryResult)) |
| p my_cursor | |
| #<RethinkDB::Cursor:0x10bead8a0 | |
| @index=1, | |
| @response= | |
| #<RethinkDB::Connection::Response:0x10beb0a50 | |
| @b=nil, | |
| @e=nil, | |
| @n=[], | |
| @p=nil, |
| base = 1 | |
| [1,2,3,4,5,6,7].each do |n| | |
| base *= 256 | |
| p base | |
| end | |
| #256 | |
| #65536 | |
| #16777216 | |
| #0 |
| def ensure_ascii_compatible_encoding(string, options = nil) | |
| if string.encoding.ascii_compatible? | |
| string | |
| else | |
| string.encode(Encoding::UTF_8, options || {:invalid => :replace, :undef => :replace}) | |
| end | |
| end |
| require "ssh2" | |
| SSH2::Session.open("localhost", 22) do |session| | |
| session.login("test", "password") | |
| session.open_session do |ch| | |
| ch.request_pty("vt100") | |
| ch.shell | |
| session.blocking = false | |
| buf_space = uninitialized UInt8[1024] |
| component Slider { | |
| property onChange : Function(Number, Void) = (value : Number) : Void => { void } | |
| property disabled : Bool = false | |
| property max : Number = 100 | |
| property value : Number = 0 | |
| property step : Number = 1 | |
| property min : Number = 0 | |
| state sliderPos : String = Number.toString(value) | |
| style rangeSlider { |
| module Array.Extra { | |
| /* | |
| Map over a nested array and then flatten: | |
| [[1,2],[1,5]] | |
| Array.Extra.flatMap((a : Array(Number) : Array(Number) => { [Array.max(n)] }) == [2,5] | |
| */ | |
| fun flatMap (func : Function(a, Array(b)), array : Array(a)) : Array(b) { | |
| Array.map(func, array) | |
| |> Array.Extra.concat() | |
| } |
| /* ------------------------------------------------------------ * | |
| * file: eckeycreate.c * | |
| * purpose: Example code for creating elliptic curve * | |
| * cryptography (ECC) key pairs * | |
| * author: 01/26/2015 Frank4DD * | |
| * * | |
| * gcc -o eckeycreate eckeycreate.c -lssl -lcrypto * | |
| * ------------------------------------------------------------ */ | |
| #include <openssl/bio.h> |
| # http://fm4dd.com/openssl/eckeycreate.htm | |
| # https://stackoverflow.com/questions/34404427/how-do-i-check-if-an-evp-pkey-contains-a-private-key | |
| # https://davidederosa.com/basic-blockchain-programming/elliptic-curve-keys/ | |
| lib LibSSL | |
| fun EC_KEY_generate_key(key : LibC::Int*) : LibC::Int | |
| fun EC_KEY_new_by_curve_name(i : LibC::Int) : LibC::Int* | |
| fun OBJ_txt2nid(s : LibC::Char*) : LibC::Int | |
| fun EVP_PKEY_new : LibC::Int* | |
| fun EVP_PKEY_assign(pkey : LibC::Int*, type : LibC::Int, key : Void*) : LibC::Int |