Skip to content

Instantly share code, notes, and snippets.

@tbfleming
tbfleming / main.abi
Last active October 20, 2021 14:06
cib eos demo: Track incoming funds
{
"structs": [{
"name": "withdraw",
"base": "",
"fields": [
{"name":"user", "type":"account_name"}
]
},{
"name": "balance",
"base": "",
@tbfleming
tbfleming / main.abi
Last active October 15, 2018 13:58
cib eos demo: self-destruct
{
"structs": [{
"name": "selfdestruct",
"base": "",
"fields": [
{"name":"user", "type":"account_name"}
]
},{
"name": "countdown",
"base": "",
@tbfleming
tbfleming / main.abi
Last active April 20, 2018 01:26
cib eos demo: Conway's Game of Life
{
"structs": [{
"name": "remove",
"base": "",
"fields": [
{"name":"user", "type":"account_name"},
{"name":"game", "type":"name"}
]
},{
"name": "removeall",
@tbfleming
tbfleming / main.abi
Created April 8, 2018 15:20
cib eos demo: currency
{
"types": [{
"new_type_name": "account_name",
"type": "name"
}
],
"structs": [{
"name": "transfer",
"base": "",
"fields": [
@tbfleming
tbfleming / main.cpp
Last active January 25, 2018 15:48
cib demo: webgl: flying bunnies
// Copyright 2018 Todd Fleming
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
@tbfleming
tbfleming / main.cpp
Last active July 8, 2021 19:53
cib demo: canvas: bouncing lines
#include <math.h>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
extern "C" double width();
extern "C" double height();
extern "C" void fillStyle(const char *);
extern "C" void strokeStyle(const char *);
@tbfleming
tbfleming / main.cpp
Last active November 11, 2018 11:47
cib demo: C++ and JS calling into each other
#include <emscripten.h>
int counter = 0;
bool running = false;
// Defined in javascript
extern "C" void enableButtons();
extern "C" void setCounterValue(int);
// Called by javascript
@tbfleming
tbfleming / main.cpp
Last active January 22, 2018 14:58
cib demo: custom console
#include <stdio.h>
int main() {
for(int i = 0; i < 20; ++i) {
for(int j = 0; j < 20; ++j)
printf("%02d ", j);
printf("\n");
}
}
@tbfleming
tbfleming / main.cpp
Last active January 13, 2018 22:59
cib demo: Boost.Format
// ----------------------------------------------------------------------------
// sample_formats.cpp : example of basic usage of format
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
@tbfleming
tbfleming / main.cpp
Last active January 14, 2018 14:33
cib demo: Range v3 comprehensions example
// Range v3 library
//
// Copyright Eric Niebler 2013-present
//
// Use, modification and distribution is subject to the
// Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// Project home: https://github.com/ericniebler/range-v3