Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

using System.IO;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
// Full disclosure: This is based on another gist, but I neglected to write down the link to it.
[CreateAssetMenu]
public class IconPacker : ScriptableObject {
public Texture2D[] textures;
// compile with g++ ecs.cpp -std=c++2a -o run && ./run
// Taken from my project, https://github.com/splinterofchaos/py-srpg
#include <vector>
#include <tuple>
#include <iostream>
template<typename F, typename...T>
constexpr auto tuple_map(F&& f, const std::tuple<T...>& t) {
return std::tuple(f(std::get<T>(t))...);
struct Seq {
size_t start, size;
};
ostream& operator<<(ostream& os, const Seq& s) {
return os << "[" << s.start << ", " << s.size << ")";
}
// Returns the number of replacements or additions required to break sequences to have no triplets.
SCRIPT /usr/local/share/nvim/runtime/syntax/syncolor.vim
Sourced 1 time
Total time: 0.001307
Self time: 0.001307
count total (s) self (s)
" Vim syntax support file
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2001 Sep 12
@splinterofchaos
splinterofchaos / nasync.vim
Last active August 29, 2015 14:18
A small script for running asynchronous nvim commands.
" From an embedded instance, evaluates an expression and sends the result back
" to the parent instance to be executed by a callback.
function! nasync#up(expr, callback)
call rpcnotify(1, 'vim_eval', a:callback . '(' . string(eval(a:expr)) . ')')
endfunction
function! s:arg_str(...)
return join(map(copy(a:000), "string(v:val)"), ',')
endfunction
@splinterofchaos
splinterofchaos / term-test.vim
Created April 6, 2015 20:26
nvim invalid read
let s:buf = -1
function! s:exit_handler()
execute 'bdelete!' s:buf
endfunction
function! s:test()
vnew
let s:buf = bufnr('%')
let id = termopen('sleep 1', { 'on_exit': function('s:exit_handler') })
@splinterofchaos
splinterofchaos / proj.cpp
Created February 17, 2015 18:35
Projection
#include <algorithm>
#include <cassert>
#include <functional>
#include <iostream>
#include <vector>
#include <fu/fu.h>
struct Person {
@splinterofchaos
splinterofchaos / Py.h
Last active August 29, 2015 14:10
Python API in C++
#ifndef PY_H
#define PY_H
#include <Python.h>
#include <type_traits>
#include <utility>
#include <string>
template<typename R, typename...X>
==18492== Memcheck, a memory error detector
==18492== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==18492== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
==18492== Command: nvim
==18492== Parent PID: 21288
==18492==
==18492== Invalid read of size 4
==18492== at 0x4B2ED1: copy_tv (eval.c:16794)
==18492== by 0x4B15BE: get_var_tv (eval.c:15965)
==18492== by 0x499294: eval7 (eval.c:4114)
let s:buf = 0 " The buffer we use to write/send data.
let s:job = 0 " The job that runs the commands.
let s:inbuf = '' " Data pending, sending to s:job.
command! Proc call s:new()
command! -nargs=* ProcDoLine call s:do_cmd(<f-args>)
command! ProcStop call jobstop(s:job)
command! ProcPressEnter call s:on_enter()