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 / textwrap.cpp
Created March 21, 2020 21:11
FLTK text justification
// Compile with FLTK (for Windows, OSX or Linux)
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/fl_draw.H>
#include <FL/Fl_Box.H>
#include <sstream>
#include <iterator>
#include <utility>
#include <string>
#include <vector>
@lighth7015
lighth7015 / wxdrag.cpp
Created March 24, 2020 13:34
wxwidgets drag child
#include <wx/wx.h>
#include <wx/utils.h>
template <class T>
class Movable : public T {
bool dragging;
int x,y;
int height, width;
int top, left, topScreen, leftScreen;
wxWindow* parent;
@lighth7015
lighth7015 / backtrace.log
Created March 29, 2020 18:30
wxWidgets backtrace
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff69de3e0 in ?? () from /usr/lib/libgtk-x11-2.0.so.0
(gdb) bt
#0 0x00007ffff69de3e0 in () at /usr/lib/libgtk-x11-2.0.so.0
#1 0x00007ffff69e45d0 in gtk_rc_get_style () at /usr/lib/libgtk-x11-2.0.so.0
#2 0x00007ffff77fb256 in wxControl::GetDefaultAttributesFromGTKWidget(_GtkWidget*, bool, int) () at /usr/lib/libwx_gtk2u_core-3.0.so.0
#3 0x00007ffff77fb6e2 in wxControl::GetDefaultAttributes() const () at /usr/lib/libwx_gtk2u_core-3.0.so.0
#4 0x00007ffff7965f8b in wxWindowBase::GetFont() const () at /usr/lib/libwx_gtk2u_core-3.0.so.0
#5 0x00007ffff7834ac5 in wxStaticText::SetFont(wxFont const&) () at /usr/lib/libwx_gtk2u_core-3.0.so.0
#6 0x0000555555561c7c in SignIn::SignIn(wxWindow*, int, wxPoint const&, wxSize const&, long) (this=0x5555555f9b40, parent=0x0, id=10000, pos=..., size=..., style=537401408) at app.cpp:71
@lighth7015
lighth7015 / app.cpp
Last active March 29, 2020 18:57
wxFrame application
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
/**
* SignIn class declaration
*/
class SignIn: public wxFrame {
@lighth7015
lighth7015 / designer.cpp
Last active March 30, 2020 19:47
Dialog designer?
class DesignerForm: public wxPanel {
DECLARE_DYNAMIC_CLASS( DesignerForm )
DECLARE_EVENT_TABLE()
auto Designable(wxControl* instance) {
auto handler = [this, instance]( wxMouseEvent& cursor ) {
wxControl& control(*instance);
wxPrintf ( "Mouse event. ID = %d\n", control.GetId());
};
@lighth7015
lighth7015 / configure.log
Created April 8, 2020 16:25
SDK build system
SDK / Build Configuration Manager
* About SDK / Build Configuration Manager:
The SDK Manager confgures your system's build environment for the product, then building and automatically
packaging it for your computer (including a bootable ISO).
* SDK / Build environment:
Build Type : release
@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": {
import { IModel } from "~/store/Model";
export default
class Application implements IModel {
public modelKey: string = "application";
}
@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
@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