Skip to content

Instantly share code, notes, and snippets.

View noorus's full-sized avatar
⚜️
One hundred percent

Noora noorus

⚜️
One hundred percent
View GitHub Profile
@noorus
noorus / ScopedSRWLock.hpp
Created February 23, 2014 22:06
Scoped SRWLOCK
//! \class ScopedSRWLock
//! Automation for scoped acquisition and release of an SRWLOCK.
//! \warning Lock must be initialized in advance!
class ScopedSRWLock: boost::noncopyable
{
protected:
PSRWLOCK mLock;
bool mExclusive;
public:
@noorus
noorus / SafeHandle.hpp
Last active August 29, 2015 13:56
unique_ptr for WinAPI HANDLEs
//! \class SafeHandle
//! Unique_ptr wrapper for WinAPI handles.
class SafeHandle: public std::unique_ptr<std::remove_pointer<HANDLE>::type,void(*)( HANDLE )>
{
public:
SafeHandle( HANDLE handle ): unique_ptr( handle, &SafeHandle::close )
{
}
operator HANDLE()
@noorus
noorus / CreditCard.php
Last active August 29, 2015 13:55
Some quickie dumb credit card decoding stuff
<?php
class CreditCard
{
const Industry_ISO = 0;
const Industry_Airlines = 1;
const Industry_Airlines2 = 2;
const Industry_Travel = 3;
const Industry_Financial = 4;
const Industry_Financial2 = 5;