Skip to content

Instantly share code, notes, and snippets.

@robinduckett
robinduckett / README.md
Created January 31, 2020 23:58
Flatten Typescript Array

flatten

A simple Typescript implementation of a map reduce method to flatten a multidimensional array.

Position of array value should be preserved in the same order it was given

API

type MultiDimensionalArray = (T | (T | T[])[])[];
@robinduckett
robinduckett / Godot Palette Replacement Shader.md
Last active March 5, 2023 03:22
A Godot shader to replace one colour in a palette with another (with a mask support for additional colours)

You must create a palette of colours and set them to the shader's parameters before use in the manner used by the Sprite script source code palette.gd

@robinduckett
robinduckett / IsometricCameraController.cs
Created January 1, 2019 16:08
RPG Top Down / Isometric Camera Controller in C# for Unity
// RPG Top Down / Isometric Camera Controller
// Tested on Unity 2018.3.0f1
// While using the setup suggested by
// https://answers.unity.com/questions/12027/how-to-do-a-camera-that-is-top-downisometric.html
// I found no off the shelf camera controllers that worked as I would have liked
// This is for basic mouse control (Rotate, Pan, Zoom)
// Improvement suggestions left as exercise for the reader:
TypeError: Cannot read property 'group' of undefined
at http://localhost:5601/bundles/kibana.bundle.js?v=8467:91959:27
at http://localhost:5601/bundles/commons.bundle.js?v=8467:12601:31
at http://localhost:5601/bundles/commons.bundle.js?v=8467:7763:28
at http://localhost:5601/bundles/commons.bundle.js?v=8467:8537:16
at baseMap (http://localhost:5601/bundles/commons.bundle.js?v=8467:7762:8)
at Function.sortBy (http://localhost:5601/bundles/commons.bundle.js?v=8467:12600:21)
at AggConfigsFactory.AggConfigs.getRequestAggs (http://localhost:5601/bundles/kibana.bundle.js?v=8467:91958:17)
at VisFactory.Vis.requesting (http://localhost:5601/bundles/kibana.bundle.js?v=8467:85179:27)
at http://localhost:5601/bundles/kibana.bundle.js?v=8467:111269:21
@robinduckett
robinduckett / conversion.html
Last active August 3, 2016 20:55
Kibana Vis Not working
<div class="conversion-rate" ng-controller="ConversionRateController as cntrl">
<div ng-if="cntrl.error" class="alert alert-danger">
<p>{{cntrl.error}}</p>
</div>
Hello World
<!-- d3 code here -->
<pre>{{ data | json }}</pre>
<!-- end d3 code -->
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to make opened Markdown files always be soft wrapped:
#
# path = require 'path'
#
var $j = (function($j) {
var funcs = [
'on', 'hide', 'is', 'toggle', 'html', 'parent'
];
var events = {};
funcs.forEach(function(func) {
events[func] = sinon.spy(jQuery.fn, func);
});
// Callback Hell. You and I both know it's hell.
// Here's a secret: Escape Callback Hell...
// ... by using classes, you fucking jackass.
// This is shit:
fs.readdir('tmp', function(err, list) {
async.map(list, function(item, cb) {
cb(null, item.toUpperCase());
}, function(err, results) {
#
# Transmission Control Class for Node.js
# @author Robin Duckett <rduckett@xumo.com>
#
request = require 'request'
_ = require 'underscore'
EventEmitter = require('events').EventEmitter