Skip to content

Instantly share code, notes, and snippets.

@RoryDungan
RoryDungan / BuildUtility.cs
Created September 23, 2019 07:12
Unity Android build keystore tool
using System.IO;
using UnityEditor;
using UnityEngine;
namespace Assets.Editor
{
/// <summary>
/// Utiltiy for making Android builds that automatically sets up the
/// keystore.
/// </summary>
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.required=true
filter.lfs.process=git-lfs filter-process
user.name=Rory Dungan
user.email=rorydungan@gmail.com
diff.tool=vimdiff
difftool.winmerge.cmd=WinMergeU -e `cygpath -w $LOCAL` `cygpath -w $REMOTE`
merge.tool=vimdiff3
merge.prompt=false
@RoryDungan
RoryDungan / split.hs
Created August 8, 2018 13:36
Split the given string up based on a max length, breaking at spaces
splitBy :: (a -> Bool) -> [a] -> [[a]]
splitBy p = map reverse . reverse . splitByInner [[]] p
splitByInner :: [[a]] -> (a -> Bool) -> [a] -> [[a]]
splitByInner acc _ [] = acc
splitByInner (current:rest) predicate (x:xs) =
if predicate x then
splitByInner ([]:current:rest) predicate xs
else
splitByInner ((x:current):rest) predicate xs
@RoryDungan
RoryDungan / count-commands.js
Created June 12, 2018 09:59
Work out which commands I use in Fish the most
'use strict'
const fs = require('fs')
const path = require('path')
const os = require('os')
const df = require('data-forge')
// Read the history of commands executed in the Fish shell and work out which
// are used the most!
const filePath = path.join(os.homedir(), '.local/share/fish/fish_history')
void DereferenceManagedObject(int32_t handle)
{
assert(handle >= 0 && handle < managedObjectsRefCountLen);
if (handle != 0)
{
auto numRemain = --managedObjectRefCounts[handle];
assert(numRemain >= 0);
if (numRemain <= 0)
{
ReleaseObject(handle);
[Binding]
public class PropertyChangedExample : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
@RoryDungan
RoryDungan / User Settings.json
Last active August 16, 2018 04:38
VS Code settings
{
"workbench.activityBar.visible": true,
"editor.wordWrap": "off",
"editor.minimap.enabled": true,
"editor.minimap.renderCharacters": false,
//**/
"editor.fontFamily": "Fira Code",
"editor.fontSize": 14.5,
"editor.letterSpacing": -0.7,
"workbench.colorTheme": "One Dark Pro",
import Control.Monad
type KnightPos = (Int, Int)
moveKnight :: KnightPos -> [KnightPos]
moveKnight (c,r) = do
(c',r') <- [(c+2,r-1), (c+2,r+1), (c-2,r+1), (c-2,r-1)
,(c+1,r-2), (c+1,r+2), (c-1,r+2), (c-1,r-2)
]
guard (c' `elem` [1..8] && r' `elem` [1..8])
BoldAsFont=-1
Font=Consolas
FontHeight=11
Transparency=off
Term=xterm-256color
CursorType=block
Scrollbar=none
Locale=en_AU
Charset=UTF-8
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
required = true
[user]
name = Rory Dungan
email =
[diff]
tool = winmerge
[difftool "winmerge"]