Skip to content

Instantly share code, notes, and snippets.

John "DumbSheep" Hsieh johnhmj

Block or report user

Report or block johnhmj

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Slashstreet Boys - I'll Kill You That Way.txt
(translated to traditional chinese by johnmhsieh)
YEAHHHHH YEAH "耶…耶…"
i'll set "我會"
you on fire "點火焚燒你"
with gas "用瓦斯"
and a lighterrrr "還有打火機…"
you'll scream "你會大聲尖叫"
when i "當我"
View main.cpp
#include <Windows.h>
//
// 1st way to avoid max conflict: undefine max from Windows.h
#ifdef max
#undef max
#endif
//
int wmain(int argc, wchar_t* argv[])
{
//
@johnhmj
johnhmj / header.cpp
Created Dec 1, 2017
AutoCAD Text height calculator
View header.cpp
#include "header.h"
//
CACADTextHeight::CACADTextHeight()
{
this->m_dDIMTXT = 0.0f;
this->m_dDIMSCALE = 0.0f;
this->m_dViewportScale = 0.0f;
this->m_dTextHeightModel = 0.0f;
this->m_dTextHeightLayout = 0.0f;
}
View SICXEPass1.pseudo
BEGIN
read first input line
IF OPCODE = 'START' THEN
BEGIN
save #[OPERAND] as starting address
initialize LOCCTR to starting address
write line to intermediate file
read next input line
END {if START}
ELSE
View SingleInstance.cpp
#include "SingleInstance.h"
//
CSingleInstance::CSingleInstance(TCHAR* pMutexName)
{
this->m_hMutex = CreateMutex(NULL, FALSE, pMutexName);
this->m_bExist = (ERROR_ALREADY_EXISTS == GetLastError())?TRUE:FALSE;
}
CSingleInstance::CSingleInstance(const CSingleInstance& instance)
{
if (this == &instance)
View WindowPosition.cpp
#include "WindowPosition.h"
//
CWndPos::CWndPos()
{
InitStruct(&this->m_pos, SWndPos);
InitStruct(&this->m_wndSize, SWndSize);
this->m_sysSize.width = GetSystemMetrics(SM_CXSCREEN);
this->m_sysSize.height = GetSystemMetrics(SM_CYSCREEN);
}
CWndPos::CWndPos(HWND hWnd)
@johnhmj
johnhmj / InitStruct.h
Last active Apr 3, 2017
Win32 C/C++ InitStruct macro, initialize your structure as ZeroMemory, http://johnmhsheep.pixnet.net/blog, https://johnmhsieh.blogspot.com/
View InitStruct.h
#ifndef _INITSTRUCT_H_
#define _INITSTRUCT_H_
//
// initialize struct
#define InitStruct(s, t) memset((void*) s, 0x0, sizeof(t))
//
// copy struct
#define CopyStruct(s_dst, s_src, t) memcpy((void*) s_dst, (void*) s_src, sizeof(t))
//
#endif
View WinMainCmdline.cpp
#include "WinMainCmdline.h"
//
CCmdLine::CCmdLine()
{
this->m_lpCmdLine = NULL;
}
CCmdLine::CCmdLine(const CCmdLine& cl)
{
unsigned int nBufferSize = 0;
this->m_lpCmdLine = NULL;
@johnhmj
johnhmj / SingleInstance.cpp
Last active Apr 3, 2017
Win32 C/C++ Only one instance of an application is allowed to run, http://johnmhsheep.pixnet.net/blog, https://johnmhsieh.blogspot.com/
View SingleInstance.cpp
#include "SingleInstance.h"
//
CSingleInstance::CSingleInstance(TCHAR* pMutexName)
{
this->m_hMutex = CreateMutex(NULL, FALSE, pMutexName);
this->m_bExist = (ERROR_ALREADY_EXISTS == GetLastError())?TRUE:FALSE;
}
CSingleInstance::CSingleInstance(const CSingleInstance& instance)
{
if (this == &instance)
@johnhmj
johnhmj / sitemap.xml
Last active Jul 13, 2016
sitemap.xml from XML-Sitemaps.com
View sitemap.xml
<?xml version="1.0" encoding="UTF-8"?>
<urlset
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<!-- created with Free Online Sitemap Generator www.xml-sitemaps.com -->
You can’t perform that action at this time.