Skip to content

Instantly share code, notes, and snippets.

View hostilefork's full-sized avatar
🌴
I'm Always Somewhere...but I'll Try And Respond

Hostile Fork hostilefork

🌴
I'm Always Somewhere...but I'll Try And Respond
View GitHub Profile
@hostilefork
hostilefork / const-wrapper-test.cpp
Created July 13, 2012 19:23
Preserving Const-Correctness of an Implementation class when Creating Wrappers
// const-wrapper-test.cpp
//
// For motivation and argumentation, reference:
// http://stackoverflow.com/questions/11167483/deriving-from-a-base-class-whose-instances-reside-in-a-fixed-format-database-m
// http://stackoverflow.com/questions/11219159/make-interchangeable-class-types-via-pointer-casting-only-without-having-to-all
#include <iostream>
#include <cassert>
#include "const-wrapper.h"
@hostilefork
hostilefork / main.cpp
Created July 30, 2012 04:49
Simple default Qt Creator program which generates ridiculous valgrind log
#include <QApplication>
#include "mainwindow.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
@hostilefork
hostilefork / genetic.cpp
Created November 25, 2012 16:01
"Genetic Algorithm" from someone's StackOverflow question
// http://stackoverflow.com/questions/13552057/c-vector-access-violation-when-trying-to-write
#include <iostream>
#include <vector>
using namespace std;
class gen {
public:
int basa_biner;
@hostilefork
hostilefork / r3-cppwarnings-initial
Last active December 9, 2015 23:08
New state after removing literal to non-const char* value assignments, after patching Rebol 3 Open Source to build with bleeding edge G++...with -fpermissive and -fshort-wchar
../src/core/b-boot.c:2917:1: warning: initializer-string for array of chars is too long [-fpermissive]
../src/core/b-init.c: In function ‘void Load_Boot()’:
../src/core/b-init.c:159:33: warning: invalid conversion from ‘void*’ to ‘REBYTE* {aka unsigned char*}’ [-fpermissive]
../src/core/b-init.c: In function ‘void Register_Codec(const REBYTE*, codo)’:
../src/core/b-init.c:704:2: warning: invalid conversion from ‘void*’ to ‘ANYFUNC {aka void (*)(void*)}’ [-fpermissive]
../src/core/b-init.c: In function ‘void Set_Option_String(REBCHR*, REBCNT)’:
../src/core/b-init.c:728:36: warning: invalid conversion from ‘REBCHR* {aka unsigned char*}’ to ‘const char*’ [-fpermissive]
../src/core/b-init.c: In function ‘REBCNT Set_Option_Word(REBCHR*, REBCNT)’:
../src/core/b-init.c:740:7: warning: invalid conversion from ‘REBCHR* {aka unsigned char*}’ to ‘const char*’ [-fpermissive]
../src/core/b-init.c: In function ‘void Init_Main_Args(REBARGS*)’:
@hostilefork
hostilefork / impure-indents.txt
Created December 31, 2012 10:39
initial findings of the make-commit.r script of "impure" indents
./r3-make -qs ../src/tools/make-commit.r
Performing Pre-Commit Tests
%../boot/boot-code.r - REBOL
2: Indentation of line not done with pure tabs.
3: Indentation of line not done with pure tabs.
4: Indentation of line not done with pure tabs.
5: Indentation of line not done with pure tabs.
6: Indentation of line not done with pure tabs.
7: Indentation of line not done with pure tabs.
@hostilefork
hostilefork / parse-find-bitset-bug.txt
Created January 13, 2013 21:17
Demonstration of problem in R3 with PARSE vs. FIND on varied bitsets, circa commit a6077e8
;-- Test the low range...
>> low: charset [#"^(00)" - #"^(80)"]
== make bitset! #{FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80}
>> find low #{40}
== true
>> find low #{A0}
== none
@hostilefork
hostilefork / single-byte-parse-bitset.txt
Created January 13, 2013 23:30
Single byte bitset parsing anomalies vs. find for binary!, circa commit a6077e8
Checking: [#{00}]
Checking: [#{01}]
Checking: [#{02}]
Checking: [#{03}]
Checking: [#{04}]
Checking: [#{05}]
Checking: [#{06}]
Checking: [#{07}]
Checking: [#{08}]
Checking: [#{09}]
@hostilefork
hostilefork / gist:6325151
Created August 24, 2013 00:08
Explicit license of a StackOverflow answer to make FontBakery happy. :-)
/*
Copyright 2012 Brian Dickens <hostilefork@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@hostilefork
hostilefork / facade.cpp
Last active December 27, 2015 06:19
Conceptual example for Proxy/Facade pattern to submit to http://codereview.stackexchange.com/questions/33713/
//
// Proxy/facade pattern idea.
// See http://codereview.stackexchange.com/questions/33713/
//
#include <iostream>
#include <vector>
#include <memory>
#include <cstdlib>
@hostilefork
hostilefork / whitespace-output.txt
Created January 26, 2014 05:26
Output from Whitespace test program run by Rebol interpreter
WHITESPACE INTERPRETER FOR PROGRAM:
---