Skip to content

Instantly share code, notes, and snippets.

//
/////////////////////////////////////////////////////
// Auto Docking
//
// Author: Spug
// Please leave credit if the ship is
// used on the workshop.
@theor
theor / belts-items.benchmark
Created February 21, 2018 14:32
Factorio-like conveyor belts benchmark
100x100 belts, 100x10 items, move_system only:
243 ns/iter (+/- 18) empty system
43,542,818 ns/iter (+/- 3,215,204) foreach belts { foreach items {
10,884,685 ns/iter (+/- 2,657,142) foreach items { belts.par_join().for_each() {
42,826 ns/iter (+/- 5,720) foreach belt { foreach item in belt.items {
83,712 ns/iter (+/- 12,581) per belt items list, parallel mutex
132,643 ns/iter (+/- 30,206) lazy update, add component to items with the computed velocity/position
// biisect - hg bisect helper
// compile: csc
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
@theor
theor / redux-fsharp.fsx
Last active November 28, 2016 14:05
Redux.Net counter sample in f#, with a couple of helper types
// needs the redux.net nuget package
#r "PresentationCore.dll"
#r "PresentationFramework.dll"
#r "../packages/Redux.NET.0.2.0/lib/portable-net45+netcore45/Redux.dll"
#r "System.Core.dll"
#r "System.dll"
#r "../packages/Rx-Core.2.2.5/lib/net45/System.Reactive.Core.dll"
#r "../packages/Rx-Interfaces.2.2.5/lib/net45/System.Reactive.Interfaces.dll"
#r "../packages/Rx-Linq.2.2.5/lib/net45/System.Reactive.Linq.dll"
#r "../packages/Rx-PlatformServices.2.2.5/lib/net45/System.Reactive.PlatformServices.dll"
@theor
theor / gist:168463ce9be344625f43
Last active August 29, 2015 14:24
Castle Dynamic Proxy sample
using System;
using Castle.DynamicProxy;
namespace ProxyTest
{
public class Interceptor : IInterceptor
{
private object _Target;
public void Intercept(IInvocation invocation)
@theor
theor / gist:8d43490b76d510586b86
Created February 9, 2015 23:16
NPM no-sudo config
Ubuntu 12.04 and using Chris Lea's PPA for install the following works for me:
npm config set prefix ~/npm
and adding $HOME/npm/bin to $PATH
append to .bashrc
export PATH="$PATH:$HOME/npm/bin"
@theor
theor / Blackbird.md
Last active August 29, 2015 14:13
Blackbird.md

Blackbird Cheatsheet

Obstacle

  • Un obstacle = N dés à réussir
  • Réussir un dé: >= 4
  • difficulté, en nombre de dés: 2 facile - 3 normal - 4 ambitieux - 5 extrême

Combien de dés utiliser ?

  • 1 dé au départ
  • 1 dé par trait, 1 dé par étiquette de ces traits
  • N dés de la réserve
@theor
theor / Blackbird
Last active August 29, 2015 14:13
Hello!
- étiquettes de noms
- secrets !
-
4 traits
6-9 tags par trait
3 clés
2 secrets
Obstacle:
@theor
theor / gist:f68468f93896c832f595
Created October 6, 2014 20:47
Json.NET: handling abstract types
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace jsonabstract
{
class Program