Skip to content

Instantly share code, notes, and snippets.

View bnolan's full-sized avatar

Ben Nolan bnolan

View GitHub Profile
@bnolan
bnolan / gist:baa806de6193035a726475e22159c0c8
Created March 22, 2021 23:21
CRYPTOVOXELS DEVELOPER TEST

(WITHOUT A CALCULATOR / GOOGLE)

Some of these numbers and operations you would come across when debugging Cryptovoxels code, so it's good to be able to mentally estimate them. Please give approximate answers (maximum of 2 decimal places), and skip questions you don't know.

  1. What is the square root of 100?


  2. What is the square root of 10?


  3. What is the square root of 2?


#include "gdexample.h"
using namespace godot;
void GDExample::_register_methods() {
register_method("_process", &GDExample::_process);
register_property<GDExample, float>("amplitude", &GDExample::amplitude, 10.0);
register_property<GDExample, float>("speed", &GDExample::set_speed, &GDExample::get_speed, 1.0);
register_signal<GDExample>((char *)"position_changed", "node", GODOT_VARIANT_TYPE_OBJECT, "new_pos", GODOT_VARIANT_TYPE_VECTOR2);
@bnolan
bnolan / mesh.cpp
Created February 21, 2021 08:49
Create mesh from GDNative in C++
#include "gdexample.h"
using namespace godot;
void GDExample::_register_methods() {
register_method("_process", &GDExample::_process);
register_property<GDExample, float>("amplitude", &GDExample::amplitude, 10.0);
register_property<GDExample, float>("speed", &GDExample::set_speed, &GDExample::get_speed, 1.0);
register_signal<GDExample>((char *)"position_changed", "node", GODOT_VARIANT_TYPE_OBJECT, "new_pos", GODOT_VARIANT_TYPE_VECTOR2);
@bnolan
bnolan / collectibles.sol
Last active February 19, 2021 03:15
Collectibles
// File: @openzeppelin/contracts/introspection/IERC165.sol
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
i have a great idea for a super ambitious project
8:07
its a search engine that has only a voice interface
8:07
you specify a little subset of html, and get people to publish their content in that format. the html is marked up with speech to text hints so that you can read it out with emphasis.
8:08
they then submit a link to their content to your search engine, and you index it and let people search it with voice.
8:08
the actual voice search you use the on-device apis provided by google or apple, you dont actually have to do that yourself.
8:08
@bnolan
bnolan / triangle.cpp
Created January 18, 2021 07:57
triangle controller
#include "FastLED.h"
#include <EEPROM.h>
// How many leds in your strip?
#define NUM_LEDS PER_PIN * 2
#define PER_PIN SEGMENT * 3
#define SEGMENT 20 * 5
#define NUM_SEGMENTS 3 * 2
// For led chips like Neopixels, which have a data line, ground, and power, you just
@bnolan
bnolan / buyback.md
Last active September 22, 2020 00:12
COLR Buyback

Hey fam, $COLR was intended as an inworld token for Cryptovoxels, but as we've moved forward, we've decided that we'll be better to use an existing token like $XDAI, or any other ERC20. And we don't have a need for our own one, so the $COLR token is a dead token.

Now - thanks to the Uniswap protocol, most people who bought $COLR will have recieved $UNI, which for some people will cover the value of your $COLR purchase.

If you are happy to treat your $COLR purchase as a donation to the ongoing development of the Cryptovoxels metaverse, that is awesome, and we hugely appreciate your support.

@bnolan
bnolan / snek.js
Last active April 22, 2020 02:30
snek.js
// Full snake game implementation
let x, y, xd, yd, z
feature.on('keys', e => {
if (e.keys.up && yd >= 0) {
yd = -1
xd = 0
} else if (e.keys.left && xd >= 0) {
yd = 0
@bnolan
bnolan / snek.js
Last active April 21, 2020 09:31
Snake for vidscreen in cryptovoxels
let x, y, xd, yd, z
feature.on('click', e => {
reset()
})
function reset () {
x = 32
y = 32
xd = 1
@bnolan
bnolan / maps.tsx
Last active April 17, 2020 00:41
Cryptovoxel maps
addMap () {
if (this.map) {
return
}
// fix weird map reload bug
let bm = document.querySelector('.big-map')
bm.innerHTML = ''
bm.className = 'big-map'
bm['_leaflet_id'] = null