Skip to content

Instantly share code, notes, and snippets.

@Rapptz
Rapptz / Bootstrap.py
Created Sep 2, 2013
Compilation helper. bootstrap
View Bootstrap.py
#!/usr/bin/env python
# Python 2.7
import os
import sys
import errno
import glob
# Meta data
project_name = 'untitled'
View gist:7593697
# This file has been generated by shinobi version 0.9.5
ninja_required_version = 1.3
builddir = bin
objdir = obj
cxx = g++
cxxflags = -std=c++11 -pedantic -pedantic-errors -Wextra -Wall -O2 -DNDEBUG
incflags = -I"."
linkflags = -static
View lua-function-test.cpp
#include <sol.hpp>
#include <iostream>
#include <tuple>
void breaking() {
std::cout << "Nice!~\n";
}
std::tuple<double, double> breaking_multi() {
return std::make_tuple(567.2, 2.567);
View static_vector.cpp
#include <type_traits>
#include <iterator>
#include <initializer_list>
#include <stdexcept>
template<typename T>
using StorageFor = typename std::aligned_storage<sizeof(T), std::alignment_of<T>::value>::type;
template<typename T, size_t N>
struct static_vector {
@Rapptz
Rapptz / hscards.json
Last active Feb 27, 2021
Hearthstone Cards
View hscards.json
[
{
"id": 7,
"name": "Garrosh Hellscream",
"description": "",
"image": "http:\/\/wow.zamimg.com\/images\/hearthstone\/cards\/enus\/medium\/HERO_01.png",
"class": "warrior",
"type": "hero",
"quality": "free",
"race": "none",
@Rapptz
Rapptz / fun.cpp
Created Feb 22, 2014
Herding Simulator 2014
View fun.cpp
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <random>
static std::random_device rd;
static std::mt19937 gen(rd());
static std::uniform_int_distribution<> dist(5, 30);
static std::uniform_int_distribution<> negator(0, 1);
View goty.cpp
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <random>
#include <map>
#include <stdexcept>
#include <functional>
#include <cstdlib>
View quick_doc.py
import sublime, sublime_plugin
def open_url(url):
sublime.active_window().run_command("open_url", { "url": url })
class PromptQuickDocCommand(sublime_plugin.WindowCommand):
def run(self):
self.window.show_input_panel("Documentation Search:", "", self.on_done, None, None)
pass
View base64.hpp
// The MIT License (MIT)
// Copyright (c) 2013-2014 Rapptz, Danny Y.
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify,
// merge, publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so, subject to the
// following conditions:
View vector.lua
local vector = {}
vector.__index = vector
local function is_vector(t)
return getmetatable(t) == vector
end
function vector.new(x, y)
return setmetatable({ x = x or 0, y = y or 0 }, vector)
end