Skip to content

Instantly share code, notes, and snippets.

🇬🇧
The road to hell is paved with good intentions

Pharap Pharap

🇬🇧
The road to hell is paved with good intentions
  • Scrumpyland
Block or report user

Report or block Pharap

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
@Pharap
Pharap / Programming Sins.md
Created Oct 11, 2019
A list of so-called 'programming sins'
View Programming Sins.md

Programming Sins

  • Magic numbers
    • Constants with a specific meaning should be clearly named
    • Possible exceptions include:
      • 0, 1 and 2 where usage is unambiguous
      • arguably the shift and mask values when doing bitshifting and masking
  • Single-letter variables names
    • With the possible exceptions of:
      • x and y for coordinates
@Pharap
Pharap / FunniestBugs.md
Last active Sep 13, 2019
A collection of amusing software bugs
View FunniestBugs.md

Funniest Bugs

Video Games

Bethesda

Morrowind

  • Ordinarily if you are kicked out of the Mages Guild you must talk to the Arch-Mage to be reinstated. Later in the quest line you can become the Arch-Mage by killing the previous Arch-Mage. If you are then expelled from the guild after having become the Arch-Mage by killing the former Arch-Mage then you can no longer be reinstated into the guild because there will no longer be an Arch-Mage to talk to.
@Pharap
Pharap / CC0.txt
Last active May 21, 2019
Pokitto Serial Example
View CC0.txt
Creative Commons Legal Code
CC0 1.0 Universal
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
@Pharap
Pharap / Vignere.h
Last active Mar 28, 2019
Vignere Cipher
View Vignere.h
#pragma once
//
// Copyright (C) 2019 Pharap (@Pharap)
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
@Pharap
Pharap / SDLInVS.md
Last active Oct 23, 2018
Steps to use SDL in VS
View SDLInVS.md
  1. VC++ Directories > Include Directories = $(SolutionDir)$(SolutionName)\Include
  2. VC++ Directories > Library Directories = $(SolutionDir)$(SolutionName)\Lib
    • $(SolutionDir)$(SolutionName)\Lib\x64 for x64
    • $(SolutionDir)$(SolutionName)\Lib\x86 for x86
  3. C/C++ > Code Generation > Runtime Library = Multi-threaded DLL (/MD)
  4. Linker > System > SubSystem = Windows (/SUBSYSTEM:WINDOWS)
  5. Linker > Input > Additional Dependencies = SDL2.lib;SDL2main.lib;
@Pharap
Pharap / PokittoLua.cpp
Created Oct 23, 2018
Pokitto + Lua example
View PokittoLua.cpp
#include "PokittoLua.h"
#include <Pokitto.h>
#include <cstdint>
int Pokitto_Display_getWidth(lua_State * state)
{
lua_pushinteger(state, Pokitto::Display::getWidth());
return 1;
@Pharap
Pharap / FuncPtr.cpp
Created Oct 21, 2018
Demonstrates that function pointer dereferencing is equivalent to identity
View FuncPtr.cpp
#include <type_traits>
#include <iostream>
int func(void) { return 42; }
int main(void)
{
auto fp0 = func;
auto fp1 = *func;
auto fp2 = *******func;
@Pharap
Pharap / StackOverflow.cs
Created Oct 13, 2018
Short C# program that crashes at runtime. Good fun.
View StackOverflow.cs
namespace StackOverflowProgram
{
class Program
{
static void Main(string[] args)
{
Main(args);
}
}
}
View NamedParams.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
public class Base
@Pharap
Pharap / example.cpp
Created Aug 25, 2018
ino vs cpp example
View example.cpp
// cpp files require these includes
// ino files do not
#include <Arduino.h>
#include <Serial.h>
// cpp files require this predeclaration
// ino files do not
void sendMessage(void);
void setup(void)
You can’t perform that action at this time.