Skip to content

Instantly share code, notes, and snippets.

View ricejasonf's full-sized avatar

Jason Rice ricejasonf

  • Henderson, NV
View GitHub Profile
@ricejasonf
ricejasonf / slither_fps.js
Created February 4, 2018 03:45
Slither.io Mod to Orient View to Player Perspective
if (typeof my_reset != "undefined") my_reset();
my_init = function() {
old_redraw = redraw;
var mag = 0.1;
var c_ang = 0;
var get_ang = function(snake_ang) {
var diff = Math.abs(snake_ang - c_ang);
if (diff < mag) return snake_ang;
else if ((c_ang < snake_ang && snake_ang - c_ang < Math.PI)
|| (c_ang > snake_ang && c_ang - snake_ang > Math.PI))
@ricejasonf
ricejasonf / main1.cpp
Created September 18, 2017 23:28
Boost.Fit Review Samples
#include <boost/fit/fold.hpp>
#include <boost/fit/alias.hpp>
#include <iostream>
#include <string>
namespace fit = boost::fit;
struct my_string_tag { };
using my_string = fit::alias_inherit<std::string, my_string_tag>;
@ricejasonf
ricejasonf / CMakeLists.txt
Created March 3, 2017 01:48
Hana GroupBy Benchmark
cmake_minimum_required(VERSION 3.5)
add_definitions(-std=c++1z)
add_definitions(-DBOOST_HANA_CONFIG_ENABLE_STRING_UDL)
add_definitions(-ftemplate-backtrace-limit=0)
add_definitions(-Wall)
add_definitions(-Wextra)
include("/opt/metabench.cmake")
# TODO use in house docker images for compilers
FROM ricejasonf/clang
WORKDIR /usr/local/src
# asio
RUN git clone https://github.com/chriskohlhoff/asio.git \
&& cd asio/asio \
&& ./autogen.sh \
&& ./configure --prefix=/usr/local --without-boost \
CXXFLAGS="-stdlib=libc++" LDFLAGS="-stdlib=libc++ -lc++abi" \
<html>
<head>
</head>
<body>
<script>
// connect
var socket = new WebSocket("ws://127.0.0.1:8080");
socket.onopen = function(event) {
@ricejasonf
ricejasonf / package.json
Created September 13, 2016 22:41
Generate Markdown for Weekly Plan from PivotalTracker
{
"name": "pivotal-tools",
"version": "1.0.0",
"description": "",
"main": "weekly_plan.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Jason Rice",
"license": "ISC",
@ricejasonf
ricejasonf / aligned_union.cpp
Last active July 21, 2016 22:55
Invalid free when aligned_union is std::swap'd containing small std::string.
#include <string>
#include <type_traits>
#include <utility>
struct my_empty { };
using storage = std::aligned_union_t<sizeof(my_empty), my_empty, std::string>;
int main()
{
template <int v>
struct int_c { static constexpr int value = v; };
struct a_tag { };
struct b_tag { };
template <bool cond>
struct c_tag
{
static_assert(cond);
};
#include<boost/hana.hpp>
namespace hana = boost::hana;
struct a_tag { };
struct b_tag { };
template <typename T>
constexpr auto get(T)
{
@ricejasonf
ricejasonf / specialize_constexpr.cpp
Created March 19, 2016 22:12
Do Stuff Inside a Function That is Declared Constexpr
#include<iostream>
struct tag1 { };
struct tag2 { };
struct tag3 { };
struct tag4 { };
template <typename Tag>
struct foo_impl { };