Skip to content

Instantly share code, notes, and snippets.

View rgoulter's full-sized avatar

Richard Goulter rgoulter

View GitHub Profile
public class TextColorTerm {
static final int RESET = 0;
static final int BRIGHT = 1;
static final int DIM = 2;
static final int UNDERLINE = 3;
static final int BLINK = 4;
static final int REVERSE = 7;
static final int HIDDEN = 8;
static final int BLACK = 0;
@rgoulter
rgoulter / output.txt
Last active December 28, 2015 06:59
IDK: C++ Rule of Three, and std::vector.
Construct some objects:
Constructor 1
Constructor 2
Constructor 3
Do some assignment:
Assignment of Foo#1 to Foo#3
Copy-constructor?
Copy Constructor Foo#4 from Foo#2
@rgoulter
rgoulter / OGL_TexMap1.cpp
Last active December 28, 2015 10:09
IDK OpenGL TextureMap 1
// For Linux, NOT CROSS-PLATFORM
#include <GL/glut.h>
#include <SOIL/SOIL.h>
#include <iostream>
GLuint texImg;
int loadedImageWidth;
int loadedImageHeight;
unsigned char *loadedImageData;
@rgoulter
rgoulter / OGL_RTT1.cpp
Created November 18, 2013 06:28
IDK OpenGL RTT 1
// For Linux, NOT CROSS-PLATFORM
#include <GL/glew.h>
#include <GL/glut.h>
#include <SOIL/SOIL.h>
#include <cstdio>
#include <iostream>
using namespace std;
GLuint texImg;
@rgoulter
rgoulter / jsonHack.java
Created December 1, 2013 17:03
Java, Reading Basic JSON
private static Map mapFromJSON(String json) throws ScriptException{
ScriptEngineManager factory = new ScriptEngineManager();
ScriptEngine engine = factory.getEngineByName("JavaScript");
engine.eval("var s = " + json);
return ((Map)engine.eval("s;"));
}
@rgoulter
rgoulter / playwithnil.m
Created January 21, 2014 06:13
Objective C, playing with nil, #1.
#import <stdio.h>
#import <Foundation/Foundation.h>
@interface Foo : NSObject
- (void)foo;
@end
@implementation Foo
- (void) foo {
printf("hello\n");
@rgoulter
rgoulter / ConstructorsAndOverriding.m
Last active August 29, 2015 13:56
Obj-C, Constructors and Overloading
#import <stdio.h>
#import <Foundation/Foundation.h>
@interface Foo : NSObject
- (void)foo;
@end
@implementation Foo
+ (void) initialize {
@rgoulter
rgoulter / CMakeLists.txt
Created February 12, 2014 02:02
CS3249 Lab1 CMake (Qt4)
cmake_minimum_required(VERSION 2.8)
PROJECT(myeditor)
FIND_PACKAGE(Qt4 REQUIRED)
SET(CMAKE_EXPORT_COMPILE_COMMANDS ON)
SET(myeditor_SOURCES main.cpp MyEditor.cpp)
SET(myeditor_HEADERS MyEditor.h)
SET(myeditor_RESOURCES myeditor.qrc)
@rgoulter
rgoulter / foo+foobar.h
Created February 15, 2014 05:29
ObjC Using Categories to Modularise Long File
#import "foo.h"
@interface Foo (foobar)
- (void) foo;
- (void) bar;
@end
@rgoulter
rgoulter / Tree.java
Last active August 29, 2015 13:56
Tree Base
package sg.nus.edu.cs2020.scratch;
import java.util.*;
// In class I forgot to put the generics as part of Tree.
// (And so my code was wrong -- exposing TreeNode to outside of Tree is 'bad').
// This is how you might do that:
public class Tree<T extends Comparable<T>> extends TreeBase<T> {
@Override