Skip to content

Instantly share code, notes, and snippets.

@iainnash
iainnash / deploy_checklist.md
Last active May 10, 2022 15:25
solidity deployment checklist draft

Deployment Checklist

Code review

  1. Are proper events emitted?
  2. Are all debugging libraries and events removed
  3. Has the contract been fully unit tested
  4. Has the contract been fully tested in testnet environment
  5. Does the contract have proper inline documentation
  6. Are tested versions of the contract codelocked and if code changes re-tested
@iainnash
iainnash / sort-ipfs-dir.py
Created January 9, 2022 16:11
sort ipfs files output by filename into json file
import re
import glob
import json
INPUT_FILE = 'files-test.txt'
OUTPUT_FILE = 'output-hashes.json'
data = []
with open(INPUT_FILE, 'r') as f:
@iainnash
iainnash / ble-heart-rate-beta-test
Created February 7, 2021 19:15
BLE Heart Rate Feather Beta Test Code
/*********************************************************************
This is code modified by Iain from Adafruit for Bluefruit LE heart rate modules.
Added: battery reporting code (bug: only reports on boot)
Added: heart rate summing and reporting code
modified by @iainnash
original example written by adafruit
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
author: mongoose-os
type: lib
description: Collection of libraries for JavaScript demos
version: 1.0
sources:
- src
libs:
- origin: https://github.com/mongoose-os-libs/core
let Max2719SPI = {
_create: ffi("void *mgos_max7219_create(void *, int)"),
_set_devices: ffi("bool mgos_max7219_set_num_devices(void *, int)"),
_set_mode: ffi("bool mgos_max7219_set_mode(void *, bool)"),
_write_digit: ffi("bool mgos_max7219_write_digit(void *, int, int, int)"),
create: function(spi) {
let obj = Object.create(Max2719SPI._proto);
obj.driver = Max2719SPI._create(spi.spi);
return driver;
ws = new WebSocket('ws://localhost:5401')
componentDidMount() {
this.ws.onopen = () => {
this.ws.onmessage = (m) => console.log(JSON.parse(m.data))
};
}
componentWillUnmount() {
this.ws.close();
}
PFont f;
void setup() {
f = createFont("Arial", 42, true);
cnt = 0;
fullScreen();
}
String[] words = {
import ShallowRenderer from 'react-test-renderer/shallow';
import {TodayIntro} from './TodayIntro';
describe('TodayIntro', () => {
it('should render a hello message with a date', () => {
MockDate.set('2018-01-01');
const renderer = new ShallowRenderer();
renderer.render(<TodayIntro name="test" />);
const result = renderer.getRenderOutput();
// Mocking out the Date.now() function (not used by moment)
const realDateNow = Date.now;
jest.spyOn(Date, 'now').mockImplementation(() => new Date('2019-01-01'));
// Test code here
Date.now.mockRestore();
// Mocking out Date constructor object (used by moment)
const nowString = '2018-02-02T20:20:20';
// Mock out the date object to return a mock null constructor
const MockDate = (lastDate) => (...args) =>
@iainnash
iainnash / first-table-configuration.jsx
Created February 23, 2018 16:48
first-table-configuration.jsx
<TableWrapper>
<TableHeader><ColumnHeader>Name</ColumnHeader><ColumnHeader>Age</ColumnHeader></TableHeader>
<RowContent columnComponents={[RenderName, RenderAge]} data={this.tableData.data} />
<TableFooter>
<Pagination onPageUpdate={this.tableData.onPageUpdate} />
</TableFooter>
</TableWrapper>