Skip to content

Instantly share code, notes, and snippets.

View lynxluna's full-sized avatar
🎯
Focusing

Didiet lynxluna

🎯
Focusing
View GitHub Profile
@lynxluna
lynxluna / main.c
Created December 8, 2012 22:01
Win32 Game Loop
#include <Windows.h>
#include <tchar.h>
#define CURRENT_WND_CLASS _T("GameWndClass_Didiet")
#define DEF_CX 800
#define DEF_CY 600
LRESULT CALLBACK WndProc( HWND, UINT, WPARAM, LPARAM );
INT WINAPI _tWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow )
@lynxluna
lynxluna / device.sh
Created July 6, 2012 00:26
Build Script for ZZiplib
NM=ntoarmv7-nm LD=ntoarmv7-ld STRIP=ntoramv7-strip RANLIB=ntoarm7-ranlib OBJDUMP=ntoarm7-objdump AR=ntoarmv7-ar CC=qcc -Vgcc_ntoarmv7le_gpp CFLAGS=-I${QNX_TARGET}/usr/include -I${QNX_TARGET}/usr/include/cpp/c -I${QNX_TARGET}/usr/include/cpp ./configure --build x86_64 --host arm --target arm --prefix=${HOME}/Projects/qnx-bin/device
@lynxluna
lynxluna / scopedptr.cpp
Created July 1, 2012 14:07
QScopedPointer
#include <QScopedPointer>
class PlayerData
{
public:
PlayerData() : health(100), atk(10), agi(10), name (new char[255]) {}
~PlayerData() { delete [] name; }
char *name;
int health, atk, agi;
};
@lynxluna
lynxluna / bigfile.c
Created April 9, 2012 01:41
Big File Reader
/*
* Copyright (c) 2012, Muhammad Sumyandityo Noor
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
@lynxluna
lynxluna / macprots.sh
Created March 21, 2012 11:19
macports upgrade
sudo port -n upgrade --force perl5.12 apr
sudo port upgrade subversion-perlbindings
@lynxluna
lynxluna / gist:2132396
Created March 20, 2012 07:16
Web clipping code
javascript:(function(){EN_CLIP_HOST='http://www.evernote.com';try{var%20x=document.createElement('SCRIPT');x.type='text/javascript';x.src=EN_CLIP_HOST+'/public/bookmarkClipper.js?'+(new%20Date().getTime()/100000);document.getElementsByTagName('head')[0].appendChild(x);}catch(e){location.href=EN_CLIP_HOST+'/clip.action?url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title);}})();
port -dfn uninstall perl5.12 apr apr-utils
port -d install perl5.12 apr apr-utils
port -d upgrade subversion-bindings
@lynxluna
lynxluna / armv5.armv6.diff
Created March 5, 2012 11:25
Apple clang 4.2 dump predefined macros
< #define __ARM_ARCH_5TEJ__ 1
---
> #define __ARM_ARCH_6K__ 1
101d100
< #define __SOFTFP__ 1
110a110
> #define __VFP_FP__ 1
@lynxluna
lynxluna / .vimrc
Created February 18, 2012 00:36
My VimRC
syn on
set cindent
set smartindent
set autoindent
set expandtab
set tabstop=4
set shiftwidth=4
set cinkeys=0{,0},:,0#,!^F
call pathogen#infect()
filetype plugin indent on
@lynxluna
lynxluna / fastinvsqrt.c
Created January 21, 2012 13:12
Fast Inverse Square Root Without Pointer Casting
/* See http://en.wikipedia.org/wiki/Fast_inverse_square_root for
For original implementation
*/
typedef union {
long l;
float f;
} LongFloat;
static inline float InvSqrt( const float v ) {