Skip to content

Instantly share code, notes, and snippets.

View rhys-vdw's full-sized avatar

Rhys van der Waerden rhys-vdw

  • Melbourne, Australia
View GitHub Profile
@rhys-vdw
rhys-vdw / ObjectHelpers.cs
Created June 28, 2021 06:06
Grouping utilities
using UnityEngine;
using UnityEditor;
using System.Linq;
using System;
namespace Feed {
public static class ObjectHelpers {
[MenuItem("Feed/Objects/Group parent position %g")]
public static void GroupSelected() {
if (!SelectedSiblings(out var selected)) {
@rhys-vdw
rhys-vdw / AssemblyDefinitionSwitch.cs
Created June 2, 2019 06:30
Script to auto-generate assemblies for back-compatibility with Unity3D's "Editor" folder magic
// Adapted from
// https://www.3delement.com/?p=586
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
using System.IO;
using Cybermonk;
class AssemblyDefinitionType // type used to load the .asmdef as json
@rhys-vdw
rhys-vdw / promote_itch.sh
Last active December 16, 2018 23:45
Copy itch binaries to a different project
#!/usr/bin/env bash
# -- Set debug flags --
set -e
# -- Utility --
# see: https://stackoverflow.com/questions/2990414/echo-that-outputs-to-stderr#comment50764513_23550347
errcho(){ >&2 echo $@; }
@rhys-vdw
rhys-vdw / sample-discord-coc.md
Created August 1, 2018 04:11 — forked from didichanoch/sample-discord-coc.md
A sample code of conduct for discord servers.

[DISCORD SERVER] Code of Conduct

Welcome!

[BRIEF DESCRIPTION OF THE DISCORD SERVER AND ITS PURPOSE]

The current admins are:

  • [NAMES]
public interface IPoolStrategy<I>
{
void ActivateInstance(I instance);
void DeactivateInstance(I instance);
I Instantitate();
}
public class ToggleActivePoolStrategy<C> : IPoolStrategy<C> where C : Component
{
public C Instantiate()
{PropTypes} = React
Option = React.createClass
displayName: 'SelectDropdown.Option'
propTypes:
selectedContent: PropTypes.node.isRequired
value: PropTypes.any.isRequired
children: PropTypes.arrayOf(PropTypes.node).isRequired
select: PropTypes.func
isSelected: PropTypes.bool
function Irritating() {
return function() {
return function() {
return function() {
this.name = 'thing';
}
}
}
}
// -- ChainFactory
// ChainFactory generates command chains that inherit from its static interface.
// Any call to `chain` will either create a new chain, or continue an existing
// one.
//
// The rule here is that every chainable method calls `chain` internally
// to get an instance of "itself". This ensure that it will make sense when
// bound to the ChainFactory constructor, and also when it's intantiated. When
// instantiated `chainInstance.chain` is overridden to return itself.
@rhys-vdw
rhys-vdw / paginate.coffee
Last active March 8, 2016 16:07
Poor man's knex/bookshelf pagination
Promise = require 'bluebird'
defaultPageSize = 20
paginate = (knex) -> (query, paginationOptions, options) ->
if query.fetchAll?
model = query
query = model.query()