Skip to content

Instantly share code, notes, and snippets.

View qpfiffer's full-sized avatar
🔚

Quinlan Pfiffer qpfiffer

🔚
View GitHub Profile
@qpfiffer
qpfiffer / basicEffectNotes.cs
Created August 1, 2011 16:34
Notes on BasicEffect
// This is how the WorlViewProj matrix is computed:
Matrix worldViewProj;
Matrix.Multiply(ref world, ref view, out worldView);
Matrix.Multiply(ref worldView, ref projection, out worldViewProj);
// This is how it is used in the HLSL file:
struct CommonVSOutput
{
float4 Pos_ps;
float4 Diffuse;
@qpfiffer
qpfiffer / zalgo.pl
Created August 2, 2011 17:09
Regex madness
$model_name =~ s/^\/(.*)\/$/$1/;
if ($model_name =~ m/([^\\]|^)\//)
{
print STDERR "Invalid model name regex.\n";
exit 1;
}
@qpfiffer
qpfiffer / Item.h
Created August 16, 2011 05:17
lolNub
#pragma once
#include <ostream>
#include <set>
#include <string>
#include <sstream>
#include <iostream>
using namespace std;
@qpfiffer
qpfiffer / DLL_Pirate.cs
Created September 8, 2011 18:37
Fun times with C# Reflection.
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
namespace DLL_Pirate
{
class Program
{
static void Main(string[] args)
@qpfiffer
qpfiffer / yeaaaah.cs
Created September 12, 2011 23:32
The best function I ever wrote.
void Downloader::DumbQueue::EnqueueUpdate(IAVEObject ^update) {
// Do nothing.
}
@qpfiffer
qpfiffer / test.cpp
Created October 13, 2011 15:04
C++ Memory Leak Detection in VS2010
#ifdef _DEBUG
#include <ostream>
#define _CRTDBG_MAP_ALLOC
#include <crtdbg.h>
#define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
#define new DEBUG_NEW
#endif
// ...
@qpfiffer
qpfiffer / reverse.cpp
Created October 29, 2011 00:27
reverse
void quack::reverse(void)
{
int i, j, temp=0;
for (i=(frontInt), j=0; j<((numItems/2)+1);
i = (i+1) % mySize, j++) {
temp = items[i].n;
items[i].n = items[(backInt-j)%mySize].n;
items[(backInt-j)%mySize].n = temp;
}
@qpfiffer
qpfiffer / rbShift.fx
Created January 9, 2012 22:25
REd Blue shift shader
float2 screenVector;
sampler2D input : register(s0);
float4 main(float2 uv : TEXCOORD) : COLOR
{
float4 toReturn;
float4 leftColor;
float4 midColor;
float4 rightColor;
@qpfiffer
qpfiffer / primes.cpp
Created February 16, 2012 06:08
Prime number thing
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
bool isPrime (long long n)
{
bool tempbool = true;
if (n <= 3) {
@qpfiffer
qpfiffer / StackBot.py
Created June 12, 2012 04:38
StackBot WIP
#!/usr/bin/python
from irc.client import n_to_nm
import irc.bot
import string
# Stupid definitions:
server = [("kremlin.pncks.com", 6667)]
channel = "#BotTesting"
nickname = "StackBot"