Instantly share code, notes, and snippets.

View Namespace Venezia (C++)
namespace Venezia
class Utils
template<typename T>
static T* SelectionSort(T arr[], int size)
for (int i = 0; i < size - 1; i++)
SELECT mov_title, mov_year FROM movie WHERE mov_year BETWEEN 1999 and 2000
GROUP BY mov_year;
UPDATE movie SET mov_title="The American Beauty" WHERE mov_title="American Beauty";
DELETE FROM movie WHERE mov_year="1999";
View (Python) def LowestRootPwr()
def LowestRootPwr():
This function prompts the user to enter an int.
Returns: Tuple of two ints, root and pwr, such that
root**pwr == userInput, while adhering to the
constraints: 0 < pwr < 6,
root and pwr have the smallest
possible absolute values.
while True:
View (C++) Airline Seat Reservation System
#include "stdafx.h"
#include <iostream>
#include <utility>
using namespace std;
void FillSeatArray(pair<char, bool> arr[][4], int sizeDim1);
// Precondition: arr is a two dimensional array of type pair<char, bool>[4].
// sizeDim1 is the size of the first array dimesion.
// Postcondition: Each four element array of type pair<char, bool> is assigned values
// representing seats. The pair at index 0 is assigned 'A', 1 is assigned 'B',
View (C++) Duelist Simulator
#include "stdafx.h"
#include <cstdlib>
#include <iostream>
#include <ctime>
#include <string>
#include <map>
using namespace std;
bool Probability(float prob);
// Precondition: prob is between 0.0 and 1.0 inclusive.
View (C++) Namespace VenzMisc
namespace VenzMisc
// Precondition: prob is between 0.0 and 1.0 inclusive.
// Returns: generates random probability between 0.0 and 1.0 and returns true if randomProb
// is <= prob, else false. Each invocation of this function has a (prob*100.0) percent chance
// of returning true.
bool Probability(float prob)
float randomProb = (RAND_MAX - rand()) / static_cast<float>(RAND_MAX);
return (randomProb <= prob) ? true : false;
View (C#) FogFXManager.cs
using UnityEngine;
public class FogFXManager : MonoBehaviour
#region Const Member Variables
const int NUM_FOG_SYSTEMS = 4;
#region Public Member Variables
public ParticleSystem widePrefab;
View (C#) ShieldPowerUp.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ShieldPowerUp : MonoBehaviour {
#region Member Variables
public static ShieldPowerUp instance;
View (C++) Parsing Ints
#include <sstream>
#include <vector>
#include <iostream>
using namespace std;
vector<int> parseInts(string str) {
istringstream iss(str);
string item;
char delim = ',';
vector<int> ints;
View (C++) Simple Vector2D
#include "stdafx.h"
#include <iostream>
using namespace std;
class Vector2D
Vector2D() : x(0), y(0) {}
Vector2D(int xVal) : x(xVal), y(0) {}
Vector2D(int xVal, int yVal) : x(xVal), y(yVal) {}