This file contains hidden or 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 <chrono> | |
template <typename Duration = std::chrono::milliseconds, | |
typename Clock = std::chrono::high_resolution_clock> | |
unsigned measure() { | |
static bool stage = false; | |
static auto ms_start = Clock::now(); | |
static auto ms_end = Clock::now(); | |
if(stage == false) { |
This file contains hidden or 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 <random> | |
template <unsigned Seed = 0, | |
typename Real = float, | |
typename RandomGenerator = std::default_random_engine> | |
Real randf() | |
{ | |
static RandomGenerator rng(Seed); | |
static std::uniform_real_distribution<Real> dst(0.0, 1.0); | |
This file contains hidden or 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
from ctypes import c_bool, c_char, c_wchar, c_byte | |
from ctypes import c_ubyte, c_short, c_ushort, c_int | |
from ctypes import c_uint, c_long, c_ulong, c_longlong | |
from ctypes import c_ulonglong, c_size_t, c_ssize_t, c_float | |
from ctypes import c_double, c_longdouble, c_char_p, c_wchar_p | |
from ctypes import c_void_p |
This file contains hidden or 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
Game Maker Studio v1.x | |
filter remove_matches ^\s*// | |
filter remove_matches ^# | |
extension gmx | |
extension gml | |
3rd_gen_scale 1.5 |
This file contains hidden or 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, typename Class, T(Class::*Getter)(), void(Class::*Setter)(const T&)> | |
class _property { | |
typedef _property<T, Class, Getter, Setter> self_type; | |
typedef T value_type; | |
typedef Class parent_type; | |
decltype(Getter) getter_func = Getter; | |
decltype(Setter) setter_func = Setter; | |
private: | |
value_type _value; |
This file contains hidden or 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
///matrix_ortho(x,y, width,height, znear,zfar) | |
// Thanks, mesa! | |
// Source from src/mesa/math/m_matrix.c:1019 | |
// Modified according to the formula at the bottom of | |
// https://msdn.microsoft.com/en-us/library/windows/desktop/bb205347(v=vs.85).aspx | |
var _x,_y,w,h; | |
_x = argument0; | |
_y = argument1; |
This file contains hidden or 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
#!/bin/bash | |
# Function to find all code labels in directory | |
# Useful for finding TODO's or NOTE's and the like | |
# Anywhere in your code, put a comment in the form // <LABEL>: ... | |
# and findlabels will pick it up | |
# Usage: | |
# findlabels <directory> (labels) | |
# (labels) is optional, put spaces between labels if you look for multiple |
This file contains hidden or 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
# Return PATH without directory | |
# | |
# @param dir directory to remove | |
function rmpath() { | |
dir="$1" | |
result="" | |
while read -r dir; do | |
if [ "$dir" != "$1" ]; then | |
result="$result:$dir" |
This file contains hidden or 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
# Spinners | |
# https://stackoverflow.com/questions/2685435/cooler-ascii-spinners | |
# "← ↖ ↑ ↗ → ↘ ↓ ↙" | |
# "▁ ▂ ▃ ▄ ▅ ▆ ▇ █ ▇ ▆ ▅ ▄ ▃ ▁" | |
# "▉▊▋▌▍▎▏▎▍▌▋▊▉" | |
# "▖▘▝▗" | |
# "┤┘┴└ ├ ┌ ┬ ┐" | |
# "◢◣◤◥" | |
# "◰◳◲◱" | |
# "◴◷◶◵" |
This file contains hidden or 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
#!/bin/sh | |
# Dependencies: | |
# pandoc: https://pandoc.org/installing.html#linux | |
# wkhtmltox: https://wkhtmltopdf.org/downloads.html | |
changelog=$1 | |
release=$2 | |
if [ -z "$changelog" ] || [ -z "$release" ]; then |
OlderNewer