Skip to content

Instantly share code, notes, and snippets.

View rhoot's full-sized avatar
🐧

Johan Sköld rhoot

🐧
View GitHub Profile
@rhoot
rhoot / explode.cpp
Created December 18, 2015 10:53
Ugly compile-time FNV-1a string hasher
// ---
// Copyright (c) 2015 Johan Sköld
// License: https://opensource.org/licenses/ISC
// ---
#include <cstdint>
#include <cstdio>
#pragma warning(push)
#pragma warning(disable: 4307) // 'operator' : integral constant overflow
@rhoot
rhoot / setImmediate.js
Last active August 29, 2015 14:00
setImmediate polyfill using Promise
// Note: You probably do not want to use this in production code, as Promise is
// not supported by all browsers yet.
(function() {
"use strict";
if (window.setImmediate) {
return;
}
@rhoot
rhoot / rc4.coffee
Last active July 7, 2017 04:27
Node.js RC4 encryption/decryption
###
Copyright (c) 2012 rhoot <https://github.com/rhoot>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
@rhoot
rhoot / gw2dattools-wrapper.cpp
Created July 13, 2012 20:14
gw2DatTools node.js wrapper
// Copyright (c) 2012 rhoot <https://github.com/rhoot>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
@rhoot
rhoot / WinMain.cpp
Created June 8, 2012 02:27
Win32 application entry point redirection
/** \file WinMain.cpp
* \author rhoot <https://github.com/rhoot>
*
* \brief Redirects calls from the windows specific WinMain() entry point to a more
* standard main() entry point defined someplace else. In debug builds, also
* allocates a console and redirects stdin, stderr, stdout to that console.
*
* \remark The std* stream redirection is based on RedirectIOToConsole(), as can be found
* at http://dslweb.nwnexus.com/~ast/dload/guicon.htm.
*/