Skip to content

Instantly share code, notes, and snippets.

View gocha's full-sized avatar

gocha gocha

View GitHub Profile
@gocha
gocha / numeric_cast.hpp
Created June 10, 2016 05:59
Numeric cast with a simple range check
/// @file
/// Numeric cast with a simple range check.
#ifndef NUMERIC_CAST_HPP_
#define NUMERIC_CAST_HPP_
#include <limits>
/// Cast a numeric value with a simple range check.
/// @param arg the numeric value to cast.
@gocha
gocha / to_floating_point.hpp
Created June 10, 2016 05:57
Generic and safe strtod wrapper for Modern C++
/// @file
/// Generic and safe strtod wrapper for Modern C++.
#ifndef TO_FLOATING_POINT_HPP_
#define TO_FLOATING_POINT_HPP_
#include <cwchar>
#include <cctype>
#include <string>
#include <type_traits>
@gocha
gocha / to_integer.hpp
Last active December 18, 2023 20:52
Generic and safe strtol wrapper for Modern C++
/// @file
/// Generic and safe strtol wrapper for Modern C++.
#ifndef TO_INTEGER_HPP_
#define TO_INTEGER_HPP_
#include <cinttypes>
#include <cwchar>
#include <cctype>
#include <string>
@gocha
gocha / stoimax.hpp
Created June 10, 2016 00:38
C++ wrapper for strtoimax and strtoumax.
/// @file
/// C++ wrapper for strtoimax and strtoumax.
#ifndef STOIMAX_
#define STOIMAX_
#include <cinttypes>
#include <string>
/// Interprets an unsigned integer value in the string.
@gocha
gocha / zlib.autopkg
Created June 2, 2016 05:59
CoApp AutoPackage script for greedy NuGet package of zlib library
configurations {
Toolset {
key: "PlatformToolset";
choices: { v140, v140_xp, v120, v120_xp };
};
Configuration {
key: "Configuration";
choices: { Release, Debug };
};
@gocha
gocha / pugixml.autopkg
Last active June 2, 2016 05:54
CoApp AutoPackage script for greedy NuGet package of pugixml library
configurations {
Toolset {
key: "PlatformToolset";
choices: { v140, v140_xp, v120, v120_xp };
};
Configuration {
key: "Configuration";
choices: { Release, Debug };
};
@gocha
gocha / fmt.autopkg
Last active June 2, 2016 05:20
CoApp AutoPackage script for greedy NuGet package of fmt library
configurations {
Toolset {
key: "PlatformToolset";
choices: { v140, v140_xp, v120, v120_xp };
};
Configuration {
key: "Configuration";
choices: { Release, Debug };
};
@gocha
gocha / midifile.autopkg
Last active June 2, 2016 06:03
CoApp AutoPackage script for greedy NuGet package of midifile library
configurations {
Toolset {
key: "PlatformToolset";
choices: { v140, v140_xp, v120, v120_xp };
};
Configuration {
key: "Configuration";
choices: { Release, Debug };
};
@gocha
gocha / CMakeLists.txt
Last active June 2, 2016 04:08
Minimal CMakeLists.txt for craigsapp's midifile library
cmake_minimum_required(VERSION 2.8)
project(midifile CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(VERSION "0.0.0")
include_directories(include)
@gocha
gocha / goemon3-hanabi-sim.lua
Created May 8, 2015 22:20
Ganbare Goemon 3 - Hanabi Shuffle Simulator
if not bit then
bit = require("bit")
end
function Goemon3HanabiOrder(hanabi_num, initial_rng)
local next_rng = function(a, x)
local data_80 = {
0x18, 0xfb, 0x78, 0xd8, 0xc2, 0x30, 0xa2, 0xaf,
0x01, 0x9a, 0xc2, 0x30, 0x8b, 0xa9, 0x00, 0x00,
0x8f, 0x00, 0x00, 0x00, 0xa9, 0xfd, 0x1f, 0xa2,