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 / 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 / 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 / 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 / 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";
import React from "react";
enum MenuTypes { Category, MenuItem, Divider }
interface MenuItem {
type: MenuTypes;
title?: string;
route?: string;
image?: SvgIcon;
items?: Array<number>;
}
@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> = [
@lighth7015
lighth7015 / vtable.c
Created April 27, 2020 12:40 — forked from michahoiting/c-vtable.c
vtable example in C
#include <stdio.h>
/* class definitions */
typedef struct Base
{
void (**vtable)();
int _x;
} Base;
typedef struct Child
@lighth7015
lighth7015 / kate.crash-log1.log
Created April 23, 2020 19:15
Kate crash logs
Application: Kate (kate), signal: Segmentation fault
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f7d67d23840 (LWP 1702726))]
Thread 2 (Thread 0x7f7d5bb7f700 (LWP 1702728)):
#0 0x00007f7d664f4abf in poll () from /usr/lib/libc.so.6
#1 0x00007f7d64994240 in ?? () from /usr/lib/libglib-2.0.so.0
#2 0x00007f7d64994311 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#3 0x00007f7d66ab58ac in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#4 0x00007f7d66a5c05c in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
import { IModel } from "~/store/Model";
export default
class Application implements IModel {
public modelKey: string = "application";
}
@lighth7015
lighth7015 / package.json
Last active April 10, 2020 15:21
package.json (yarn)
{
"name": "webext-preact-typescript-starter",
"version": "1.0.0",
"description": "A starter for web extension projects with Preact and Typescript",
"main": "index.tsx",
"engines": {
"node": ">=8.0.0",
"npm": ">=6.0.0"
},
"scripts": {