This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import console | |
from random import randint, choice, randrange | |
class Board: | |
def __init__(self, xSize=4, ySize=4): | |
self.xSize=xSize | |
self.ySize=ySize | |
self.tiles=[] | |
for i in range(self.ySize): | |
self.tiles.append([]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Just unzip SDL2 zip file into CMAKE_SOURCE_DIR | |
# This doesn't work with VS2015 | |
cmake_minimum_required(VERSION 3.1) | |
project(sdl2test) | |
#set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") | |
#find_package(SDL2 REQUIRED) | |
#message(status $ENV{SDL2DIR}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <fstream> | |
#include <string> | |
#define STR(x) #x | |
#define STRINGIFY(x) STR((x)) | |
#define ERROR_INFO __FILE__ " : " __FUNCTION__ " : " STRINGIFY(__LINE__) " : " | |
class Error_Logger { | |
private: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename T> | |
int time_it() | |
{ | |
using milliseconds_t = std::chrono::duration < int, std::milli >; | |
//start time | |
auto start = std::chrono::steady_clock::now(); | |
//instantiate class | |
T class_to_time; | |
//do stuff to time it |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Author: Ben Kane | |
cmake_minimum_required(VERSION 3.1) | |
# Name the Project that holds all other projects | |
project(Sandbox) | |
# add warnings to all projects | |
if(MSVC) | |
add_compile_options(/W4 /wd4100) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <string> | |
int main() | |
{ | |
std::string i{"Hello"}; | |
// static_assert(std::is_same<decltype(i), char>(), "Oops!"); | |
std::vector<decltype(i)> v {i}; | |
for(auto i: v) { std::cout << i << std::endl; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Desktop Entry] | |
Name=Spyder Python IDE | |
Comment=Edit text files | |
Exec=/home/ben/anaconda3/bin/spyder | |
Terminal=false | |
Type=Application | |
StartupNotify=true | |
MimeType=text/plain; | |
Icon=/home/ben/.local/share/applications/spyder.png | |
Categories=GNOME;GTK;Utility;TextEditor; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import contextlib | |
import sqlite3 | |
CREATE_TABLES_SQL = """ | |
CREATE TABLE IF NOT EXISTS word | |
( | |
id INTEGER NOT NULL, | |
word TEXT UNIQUE NOT NULL, | |
number INTEGER DEFAULT 1, | |
PRIMARY KEY (id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <algorithm> | |
#include <cassert> | |
#include <chrono> | |
#include <iostream> | |
#include <vector> | |
#include <random> | |
// NOTE: All iterator concepts are experimental. I'm not going | |
// to concentrate on them |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <iterator> | |
#include <array> | |
#include <string> | |
// I think this will bloat binary size and be slower, | |
// but it's for convenient printing, which is worth it :) | |
// TODO: don't always call by value... | |
// Of course, I'm mostly passing ints and strings, so it's probably not too |
OlderNewer