Skip to content

Instantly share code, notes, and snippets.

@RoryDungan
RoryDungan / BuildUtility.cs
Created Sep 23, 2019
Unity Android build keystore tool
View BuildUtility.cs
using System.IO;
using UnityEditor;
using UnityEngine;
namespace Assets.Editor
{
/// <summary>
/// Utiltiy for making Android builds that automatically sets up the
/// keystore.
/// </summary>
View .gitconfig
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 Aug 8, 2018
Split the given string up based on a max length, breaking at spaces
View split.hs
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 Jun 12, 2018
Work out which commands I use in Fish the most
View count-commands.js
'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')
View DereferenceManagedObject.cpp
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);
View PropertyChangedExample.cs
[Binding]
public class PropertyChangedExample : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
View User Settings.json
{
"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",
View Knight.hs
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])
View .minttyrc
BoldAsFont=-1
Font=Consolas
FontHeight=11
Transparency=off
Term=xterm-256color
CursorType=block
Scrollbar=none
Locale=en_AU
Charset=UTF-8
View .gitconfig windows cygwin
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
required = true
[user]
name = Rory Dungan
email =
[diff]
tool = winmerge
[difftool "winmerge"]