Skip to content

Instantly share code, notes, and snippets.

View harrishancock's full-sized avatar

Harris Hancock harrishancock

View GitHub Profile
@harrishancock
harrishancock / gist:d4c59027b0c3aeb4bc26
Last active August 29, 2015 14:24
Some version parsing, generating, and comparison functions
// If a string begins with 'v' and ends with a dotted sequence of numbers,
// return an array of those numbers. Otherwise, return null.
// Examples:
// 'v1' -> [ 1 ]
// 'v1.2' -> [ 1, 2 ]
// 'v1.2.3' -> [ 1, 2, 3 ]
// '1.2.3' -> null
function parseVersion (v) {
function parseDecInt (a) {
return parseInt(a, 10);

Keybase proof

I hereby claim:

  • I am harrishancock on github.
  • I am harrishancock (https://keybase.io/harrishancock) on keybase.
  • I have a public key whose fingerprint is E745 2B7C ECD1 C710 3B29 82AA B17E B3C0 0A14 1ABF

To claim this, I am signing this object:

Scanning dependencies of target capnp-heavy-tests
[ 84%] Building CXX object src/capnp/CMakeFiles/capnp-heavy-tests.dir/compat/json-test.c++.o
/home/harris/git/sandstorm/capnproto/c++/src/capnp/compat/json-test.c++: In member function ‘virtual void capnp::_::{anonymous}::TestCase673::run()’:
/home/harris/git/sandstorm/capnproto/c++/src/capnp/compat/json-test.c++:675:8: warning: variable ‘root’ set but not used [-Wunused-but-set-variable]
auto root = message.getRoot<test::TestOldVersion>();
^
In file included from /home/harris/git/sandstorm/capnproto/c++/src/capnp/compat/json-test.c++:22:0:
/home/harris/git/sandstorm/capnproto/c++/src/capnp/compat/json.h: In instantiation of ‘capnp::Orphan<capnp::DynamicValue> capnp::JsonCodec::Handler<T, (capnp::Style)3u>::decodeBase(const capnp::JsonCodec&, capnp::JsonValue::Reader, capnp::Orphanage) const [with T = capnproto_test::capnp::test::TestInterface]’:
/home/harris/git/sandstorm/capnproto/c++/src/capnp/compat/json-test.c++:703:1: required from here
/hom
#include <capnp/test.capnp.h>
// ...
using ::capnproto_test::capnp::test::TestInterface
class TestCapabilityHandler: public JsonCodec::Handler<TestInterface> {
public:
void encode(const JsonCodec& codec, TestInterface::Client input,
JsonValue::Builder output) const override {
#include <capnp/test.capnp.h>
// ...
using ::capnproto_test::capnp::test::TestInterface
class TestCapabilityHandler: public JsonCodec::Handler<TestInterface> {
public:
void encode(const JsonCodec& codec, TestInterface::Client input,
JsonValue::Builder output) const override {
[ 84%] Building CXX object src/capnp/CMakeFiles/capnp-heavy-tests.dir/compat/json-test.c++.o
In file included from /home/harris/git/sandstorm/capnproto/c++/src/capnp/compat/json-test.c++:22:0:
/home/harris/git/sandstorm/capnproto/c++/src/capnp/compat/json.h: In instantiation of ‘capnp::Orphan<capnp::DynamicValue> capnp::JsonCodec::Handler<T, (capnp::Style)3u>::decodeBase(const capnp::JsonCodec&, capnp::JsonValue::Reader, capnp::Orphanage) const [with T = capnproto_test::capnp::test::TestInterface]’:
/home/harris/git/sandstorm/capnproto/c++/src/capnp/compat/json-test.c++:703:1: required from here
/home/harris/git/sandstorm/capnproto/c++/src/capnp/compat/json.h:379:31: error: could not convert ‘capnp::JsonCodec::Handler<T, (capnp::Style)3u>::decode<capnproto_test::capnp::test::TestInterface>((* & codec), input)’ from ‘capnproto_test::capnp::test::TestInterface::Client’ to ‘capnp::Orphan<capnp::DynamicValue>’
return decode(codec, input);
^
In file included from /home/harris/
#include <capnp/test.capnp.h>
// ...
using ::capnproto_test::capnp::test::TestInterface;
class TestCapabilityHandler: public JsonCodec::Handler<TestInterface> {
public:
void encode(const JsonCodec& codec, TestInterface::Client input,
JsonValue::Builder output) const override {
c:\users\vortr\git\sandstorm\capnproto\c++\src\capnp\orphan.h(345): error C2672: 'capnp::_::structSize': no matching overloaded function found [
C:\Users\vortr\git\sandstorm\build-capnp-vs2015\src\capnp\capnp-json.vcxproj]
c:\users\vortr\git\sandstorm\capnproto\c++\src\capnp\compat\json.h(326): note: see reference to function template instantiation 'capnp::Orphan
<capnp::DynamicStruct> capnp::Orphanage::newOrphan<T>(void) const' being compiled
with
[
T=capnp::DynamicStruct
]
c:\users\vortr\git\sandstorm\capnproto\c++\src\capnp\compat\json.h(324): note: while compiling class template member function 'capnp::Orphan<c
apnp::DynamicStruct> capnp::JsonCodec::Handler<capnp::DynamicStruct,capnp::Style::STRUCT>::decode(const capnp::JsonCodec &,capnp::JsonValue::R
[ 84%] Building CXX object src/capnp/CMakeFiles/capnp-heavy-tests.dir/compat/json-test.c++.o
In file included from /home/harris/git/sandstorm/capnproto/c++/src/capnp/list.h:30:0,
from /home/harris/git/sandstorm/capnproto/c++/src/capnp/generated-header-support.h:32,
from /home/harris/git/sandstorm/capnproto/c++/src/capnp/schema.capnp.h:7,
from /home/harris/git/sandstorm/capnproto/c++/src/capnp/schema.h:33,
from /home/harris/git/sandstorm/capnproto/c++/src/capnp/compat/json.h:25,
from /home/harris/git/sandstorm/capnproto/c++/src/capnp/compat/json-test.c++:22:
/home/harris/git/sandstorm/capnproto/c++/src/capnp/orphan.h: In instantiation of ‘capnp::Orphan<RootType> capnp::Orphanage::newOrphan() const [with RootType = capnp::DynamicStruct]’:
/home/harris/git/sandstorm/capnproto/c++/src/capnp/compat/json-test.c++:716:52: required from here
/home/harris/git/sandstorm/capnproto/c++/src/capnp/orphan.h:345:96: error: no matching func
<xml xmlns="http://www.w3.org/1999/xhtml">
<block type="variables_set" id="S7L#M^1J7tsDf7Q})LOc" x="13" y="13">
<field name="VAR">robot</field>
<value name="VALUE">
<block type="linkbotjs_connect" id=")vVt812xjZcgfB@{rU,T"></block>
</value>
<next>
<block type="controls_for" id="sw#nvc1IL^k*#C2!+@Yd">
<field name="VAR">t</field>
<value name="FROM">