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
#pragma once | |
#include <utility> | |
// varidic max, min, and minmax implementation (named maximum, minimum and min_max to avoid confusion) | |
// no support for custom comparators (mainly because i'm not sure how they should be specified) | |
namespace detail { | |
// max base case | |
template <class T> |
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 <lua.h> | |
#include <lauxlib.h> | |
#include <lualib.h> | |
#include <stdlib.h> | |
int map_create(lua_State *lua); | |
int map_slice(lua_State *lua); | |
int main(int argc, char **argv){ | |
lua_State *lua = lua_open(); |
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 pygame | |
import sys | |
def surfaceFlip(img,w,h, fx, fy): | |
r = img.get_rect() | |
target = pygame.Surface( r.size, 0, img ) | |
tmp = pygame.Surface( (w,h), 0, img) | |
ix, iy = r.width/w, r.height/h | |
dst = pygame.Rect(0,0,w,h) | |
r.topleft = (0,0) |
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
// lib /def:user32.def | |
// cl /O2 test.cpp /link user32.lib | |
#include <Windows.h> | |
#include <stdio.h> | |
struct PrecisionTouchPadConfig { | |
BYTE LegacyParams[3]; | |
BOOL LoadedSettings; | |
// 0: No delay (always on) |
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 before switching jobs: | |
// Add one of these. | |
// Preferably into the same commit where you do a large merge. | |
// | |
// This started as a tweet with a joke of "C++ pro-tip: #define private public", | |
// and then it quickly escalated into more and more evil suggestions. | |
// I've tried to capture interesting suggestions here. | |
// | |
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_, | |
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant, |
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
// This code is WIP and does not reflect the final one, but gets a rough idea on how to use continuation | |
// task for exception catching when workin with Async operations | |
inline concurrency::task<std::vector<byte>> ReadEntireFileFromPath(const std::wstring& filename) | |
{ | |
using namespace Windows::Storage; | |
using namespace Windows::Foundation; | |
using namespace Concurrency; | |
auto taskFileFromPath = create_task(StorageFile::GetFileFromPathAsync(Platform::StringReference(filename.c_str()))); | |
return taskFileFromPath.then([](task<StorageFile^> tfile) |
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
/*============================================================================ | |
NVIDIA FXAA 3.11 by TIMOTHY LOTTES | |
------------------------------------------------------------------------------ | |
COPYRIGHT (C) 2010, 2011 NVIDIA CORPORATION. ALL RIGHTS RESERVED. | |
------------------------------------------------------------------------------ | |
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED |
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
// Modified version of a tilt shift shader from Martin Jonasson (http://grapefrukt.com/) | |
// Read http://notes.underscorediscovery.com/ for context on shaders and this file | |
// License : MIT | |
uniform sampler2D tex0; | |
varying vec2 tcoord; | |
varying vec4 color; | |
/* | |
Take note that blurring in a single pass (the two for loops below) is more expensive than separating |
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
// ------- COPY | |
{ | |
char some[256]; // your text here, zero ended | |
OpenClipboard(GetDesktopWindow()); | |
EmptyClipboard(); | |
HGLOBAL hg=GlobalAlloc(GMEM_MOVEABLE,ARRAYSIZE(some)+1); | |
if (!hg) | |
{ | |
CloseClipboard(); | |
return; |
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
// The following test measures time to find the minimum value in a huge array using: | |
// sequential | |
// parallel_for_each | |
// parallel_for_each + combinable<> | |
// VS2015 Update 3 | |
static char toClearCache[256 << 20]; //try to flush!? | |
static void clearCache() | |
{ |
NewerOlder