Skip to content

Instantly share code, notes, and snippets.

View lighth7015's full-sized avatar
Perpetually exhausted.

Robert Butler lighth7015

Perpetually exhausted.
View GitHub Profile
@lighth7015
lighth7015 / AppDrawer.tsx
Last active April 28, 2020 17:07
Stack Menu Implementation
import React from "react";
import { h } from "react";
export default
class AppDrawer extends React.Component<AppDrawerProps, AppDrawerState> {
state: AppDrawerState = {
current: [0]
};
private entries: Array<MenuItem> = [
import React from "react";
enum MenuTypes { Category, MenuItem, Divider }
interface MenuItem {
type: MenuTypes;
title?: string;
route?: string;
image?: SvgIcon;
items?: Array<number>;
}
@lighth7015
lighth7015 / base.tsx
Last active April 29, 2020 22:57
Menu component
import * as React from "preact";
import { h, Fragment } from "preact";
import Match from "preact-router/match";
import { forwardRef } from "preact/compat";
import { Link } from "preact-router/match";
import Slide from "@material-ui/core/Slide";
import Drawer from "@material-ui/core/Drawer";
import Divider from "@material-ui/core/Divider";
import List from "@material-ui/core/List";
import ListItem from "@material-ui/core/ListItem";
@lighth7015
lighth7015 / test.c
Created May 2, 2020 14:22
Calculating maximum number based on value of enum
#include <stdio.h>
enum { MAX_NUM_OBJECTS = 29 };
typedef struct {
union {
uint32_t mask;
struct {
bool available : 1;
bool client : 1;
@lighth7015
lighth7015 / hash.c
Last active May 16, 2020 17:31
hash.c
#include <stdbool.h> /* bool, true, false */
#include <stdio.h> /* printf */
#include <string.h> /* strdup */
#include <stdlib.h> /* calloc */
typedef struct hash_t {
size_t size, count;
size_t bytes;
const char **keys;
struct hash_t** items;
@lighth7015
lighth7015 / cargo.build.log
Created May 29, 2020 19:12
Cargo build log for Yew app
[robert.butler@mc01 multi_thread]$ cargo build --target wasm32-unknown-unknown
Compiling cfg-if v0.1.10
Compiling futures-core v0.3.5
Compiling once_cell v1.4.0
Compiling futures-sink v0.3.5
Compiling pin-utils v0.1.0
Compiling futures-io v0.3.5
Compiling slab v0.4.2
Compiling itoa v0.4.5
error[E0463]: can't find crate for `core`
@lighth7015
lighth7015 / tsconfig.json
Created June 20, 2020 06:54
tsconfig.json
{
"compilerOptions": {
"target": "es6",
"lib": [ "dom", "dom.iterable", "esnext" ],
"jsx": "react",
"jsxFactory": "React.h",
"module": "commonjs",
"moduleResolution": "node",
@lighth7015
lighth7015 / build.log
Created June 25, 2020 10:23
node-gyp sqlite3 failure
warning Error running install script for optional dependency: "/usr/share/.config/yarn/global/node_modules/bufferutil: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: /usr/share/.config/yarn/global/node_modules/bufferutil
Output:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info find Python using Python version 3.8.3 found at \"/usr/bin/python3\"
@lighth7015
lighth7015 / tsconfig.json
Created June 25, 2020 15:07
tsconfig.json
{
"compilerOptions": {
/* Basic Options */
"incremental": true, /* Enable incremental compilation */
"target": "es2019", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"module": "esnext", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
"lib": [
"es2019",
"dom"
], /* Specify library files to be included in the compilation. */
export interface TableInfo {
tableId: string;
columns: Array<string>;
}
export interface StorageInfo {
[key: string]: string | TableInfo;
}
interface PageInfo {