Skip to content

Instantly share code, notes, and snippets.

@TheBuzzSaw
TheBuzzSaw / References.k
Created July 21, 2013 16:41
I wonder how much the compiler would be able to detect as far as dangling pointers are concerned.
import K.Core;
export ReferencesSample;
void ObviousFailure()
{
int32 x = 7;
weak int32 r = x;
if (r > 5)
{
#include <iostream>
using namespace std;
char rotate(char c)
{
char result = c;
char base = 0;
if (c >= 'a' && c <= 'z')
{
@TheBuzzSaw
TheBuzzSaw / suits.cpp
Last active December 23, 2015 07:08
Card Suits! =]
#include <iostream>
using namespace std;
enum suits { CLUBS, DIAMONDS, SPADES, HEARTS };
struct card
{
int number;
suits suit;
};
@TheBuzzSaw
TheBuzzSaw / Fibonacci.cpp
Last active January 4, 2016 06:19
Fibonacci
#include <iostream>
using namespace std;
int Get(int n)
{
int a = 0;
int b = 1;
for (int i = 0; i < n; ++i)
{
#include <iostream>
#include <unordered_set>
#include <cstdint>
using namespace std;
typedef unordered_set<int64_t> NumberSet;
int64_t Go(int64_t n)
{
int64_t total = 0;
local gr = Nullocity.GetRandom
entitiesByHandle = {}
cameraEntity = nil
function FixPosition(entity)
local px, py = entity.GetPosition()
local vx, vy = entity.GetVelocity()
local radius = entity.GetRadius()
local gr = Nullocity.GetRandom
entitiesByHandle = {}
cameraEntity = nil
function FixPosition(entity)
local px, py = entity.GetPosition()
local vx, vy = entity.GetVelocity()
local radius = entity.GetRadius()
#include "sqlite3.h"
#include <iostream>
#include <fstream>
#include <unordered_map>
#include <string>
#include <cstring>
using namespace std;
const char OneHalf[] = { (char)0xc2, (char)0xbd, 0x00 };
const char OneQuarter[] = { (char)0xc2, (char)0xbc, 0x00 };
@TheBuzzSaw
TheBuzzSaw / VectorStreamer.hpp
Last active August 29, 2015 14:03
Automatic Vector Streamer
template<class T>
std::ostream& operator<<(std::ostream& stream, const std::vector<T>& content)
{
stream << "[";
if (content.size() > 0)
{
stream << content[0];
for (std::size_t i = 1; i < content.size(); ++i)
#ifndef XMLWRITER_HPP
#define XMLWRITER_HPP
#include <iostream>
#include <string>
#include <vector>
namespace Kelly
{
class XmlWriter