Skip to content

Instantly share code, notes, and snippets.

View dpogue's full-sized avatar
👨‍💻
I may be slow to respond.

Darryl Pogue dpogue

👨‍💻
I may be slow to respond.
View GitHub Profile
@dpogue
dpogue / gist:752680
Created December 23, 2010 07:05
Python try/except/finally bytecode
*****************************************
* try: *
* import sys *
* try: *
* print 'something else' *
* except AssertionError: *
* print '...failed' *
* except ImportError: *
* print 'Oh Noes!' *
* finally: *
@dpogue
dpogue / gist:1244371
Created September 27, 2011 04:56
try/except Python bytecode
print 'before'
try:
print('try')
except SyntaxError:
print 'except'
print 'after'
===============================================================================
@dpogue
dpogue / vcpkg.md
Last active January 13, 2024 19:54

vcpkg in H-uru/Plasma

The H-uru/Plasma repo uses vcpkg to manage C++ library dependencies. The libraries provided by vcpkg are called "ports" and it's a model similar to MacPorts, pacman (PKGBUILD), and other common software package managers.

One difference from typical package managers is that vcpkg also tries to accomodate different target compilers and target systems, as well as different build configuations. To do this, it uses a concept it calls "triplets". A triplet is an architecture, platform, and linking type (i.e., x86-windows-dynamic or x64-windows-static).

When you install Visual Studio 2022 with Desktop C++ component, vcpkg is automatically installed as well. You can also download vcpkg as a standalone tool, or use it as part of a CMake build system. The H-uru/Plasma repo uses CMake as its build system, so it has opted to use vcpkg's CMake integration, controlled by the USE_VCPKG boolean flag. By default this is enabled on

class plClientWindow
{
protected:
pcSmallRect fWindowSize;
public:
plClientWindow() : fWindowSize(0, 0, 800, 600) { }
virtual ~plClientWindow() = default;
/**
@dpogue
dpogue / main.cpp
Created August 25, 2012 03:15
Qt working directory path stuff for Mac
int main(int argc, char **argv) {
QApplication a(argc, argv);
QDir bin(QCoreApplication::applicationDirPath());
/* Set working directory */
#if defined(Q_WS_MAC)
bin.cdUp(); /* Fix this on Mac because of the .app folder, */
bin.cdUp(); /* which means that the actual executable is */
bin.cdUp(); /* three levels deep. Grrr. */
#endif
#include <CoreFoundation/CoreFoundation.h>
#include <stdio.h>
int main(int argc, char** argv)
{
CFStringRef str = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
printf("Ref Count: %d\n", CFGetRetainCount(str));
return 0;
}

pnAsyncCore

  • plStatusLog for pnAcLog
    • Kill pnAcLog, used by some pnNetCli and plNetGameLib stuff

pnInputCore

  • plLocalization stuff for translated keyboard key names
    • Move to plInputCore or replace

/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
<?xml version="1.0" encoding="utf-8"?>
<plWaveSet7>
<plKey Name="cWater_Harbor" Type="plWaveSet7" Location="6;3" LocFlag="0x0000" LoadMask="0xFFF0" ObjID="1" />
<SyncParams flags="0x00000000">
<ExcludePersistentStates></ExcludePersistentStates>
<VolatileStates></VolatileStates>
</SyncParams>
<ModFlags>
<hsBitVector></hsBitVector>
@dpogue
dpogue / st_cocoa.h
Last active February 19, 2023 06:46
#include <CoreFoundation/CoreFoundation.h>
[[nodiscard]]
CFStringRef CFStringCreateWithSTString(CFAllocatorRef alloc, const ST::string& stString)
{
return CFStringCreateWithCString(alloc, stString.c_str(), kCFStringEncodingUTF8);
}
[[nodiscard]]
const ST::string CFStringGetSTString(CFStringRef theString)