Skip to content

Instantly share code, notes, and snippets.

Avatar

Krzysztof 'Dalton' Pachulski daltondotgd

View GitHub Profile
@daltondotgd
daltondotgd / Class.sublime-snippet
Created Jun 21, 2014
Sublime: new JavaScript class snippet (for straps.js inheritance model)
View Class.sublime-snippet
<snippet>
<content><![CDATA[
var ${1:Class} = ${2:Base}.extend({
initialize: function ${1:Class}(${3}) {
${4}
},
});
]]></content>
View Convex Hull
/*
* Copyright (c) 2014 Krzysztof Pachulski
* License: The MIT License (MIT)
* MIT License page: http://opensource.org/licenses/MIT
*
* getConvexHull() function calculates a convex hull of a cloud
* of points defined as a vector of points.
*
* getConvexHull() function uses Point and Edge classes
* provided below.
@daltondotgd
daltondotgd / VSyncForCocos2dX.cpp
Created Aug 27, 2014
To enable VSync for WIN32 in cocos2d-x, modify initWithRect(...) function in CCGLView.cpp, so it contains this code right before 'initGlew();'
View VSyncForCocos2dX.cpp
...
...
...
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
// Turn on vertical screen sync under Windows.
// (I.e. it uses the WGL_EXT_swap_control extension)
typedef BOOL(WINAPI *PFNWGLSWAPINTERVALEXTPROC)(int interval);
PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = NULL;
wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress("wglSwapIntervalEXT");
@daltondotgd
daltondotgd / GetAllBoolPropertyValues.cpp
Last active Nov 1, 2018
UE4 list all properties of a type
View GetAllBoolPropertyValues.cpp
for (TFieldIterator<UProperty> prop_It(this->GetClass()); prop_It; ++prop_It)
{
if (UBoolProperty* BoolProperty = Cast<UBoolProperty>(*prop_It))
{
UE_LOG(LogTemp, Log, TEXT("%s: %s"), *BoolProperty->GetName(), BoolProperty->GetPropertyValue(this) ? TEXT("true") : TEXT("false"));
}
}