Skip to content

Instantly share code, notes, and snippets.

@dimitarcl
dimitarcl / Makefile
Created October 18, 2018 06:12
Xcode 9+ operator new
all: clean a.out test
liblib.dylib: lib.cc unexported.txt
clang++ ${CXXFLAGS} -std=c++14 -dynamiclib -single_module lib.cc -o liblib.dylib -Wall -Wl,-unexported_symbols_list,unexported.txt
a.out: main.cc liblib.dylib
clang++ ${CXXFLAGS} -std=c++14 main.cc -llib -L .
clean:
rm -f a.out liblib.dylib
test:
./a.out
@dimitarcl
dimitarcl / UIResourcesMonitor.cs
Last active December 20, 2015 01:49
Automatically reloading a Coherent UI view in Unity3D when the resources have changed.
// Disclaimer: This snippet illustrates an idea and may contain bugs. Use with caution.
using UnityEngine;
using System.IO;
public class UIResourcesMonitor : MonoBehaviour {
FileSystemWatcher m_Watcher;
@dimitarcl
dimitarcl / Player.cs
Last active December 16, 2015 20:39
Using Coherent UI with typescript
namespace Game
{
public struct Item
{
int Id;
string Name;
}
public class Player
{
@dimitarcl
dimitarcl / Game.cs
Last active December 16, 2015 14:59
Coherent UI 1.2.1
using Coherent.UI;
using Coherent.UI.Binding;
namespace MyGame
{
class Options
{
public bool SetWindowSize(int width, int height);
}
@dimitarcl
dimitarcl / GetConfigInclude.lua
Last active December 11, 2015 07:28
Converting a gyp library to premake
function GetConfigInclude(cfg)
local arch = cfg.architecture
local system = cfg.system
if arch == 'x32' or arch == 'Win32' then
arch = 'ia32'
end
if system == 'windows' then
system = 'win'
end
return string.format('config/%s/%s', system, arch)
@dimitarcl
dimitarcl / GetExtensionDir.js
Created November 5, 2012 22:08
Brackets in Coherent UI
appshell.app.getApplicationSupportDirectory = function () {
return appshell.app.applicationSupportDirectory;
}
appshell.app.applicationSupportDirectory = '.';
engine.on('SetApplicationSupportDirectory', function (directory) {
appshell.app.applicationSupportDirectory = directory;
});
@dimitarcl
dimitarcl / HTTPServer.asm
Created September 23, 2012 14:08
A twist on PImpl
?GetPort@HTTPServer@@QBEGXZ PROC ; HTTPServer::GetPort, COMDAT
; _this$ = ecx
mov ax, WORD PTR [ecx]
ret 0
@dimitarcl
dimitarcl / Doxyfile
Created September 22, 2012 21:22
Documenting JavaScript with Doxygen
FILTER_PATTERNS =*.js=doxygen.js