Skip to content

Instantly share code, notes, and snippets.

@nanodeath
nanodeath / config.yml
Created August 31, 2022 03:46
Unity CircleCI + itch.io
version: 2.1
orbs:
unity: game-ci/unity@1.0.0
jobs:
build-windows:
executor:
name: unity/ubuntu
editor_version: 2021.3.8f1
@nanodeath
nanodeath / note.md
Last active March 12, 2022 16:03
Svelte rollup.config.js with multiple bundles

The adjacent file is identical to the one provided by the Svelte 3.x library (3.46.x-ish) with the following distinctions:

  1. I updated the config with a little help from the docs to create a separate bundle for each .ts file in the src/ directory.
  2. I ran the provided script that adds TypeScript support.
  3. I updated the output.file property to point to the build directory in the parent (this is nested in a bigger Gradle project).

Note that you'll still need to create a separate .ts file (analogous to the initial main.ts) for each bundle.

Hope someone finds this useful.

@nanodeath
nanodeath / _post.md
Created April 17, 2021 18:00
Downloading and unpacking WebJars with Gradle Kotlin for use with Sass

If you're doing frontend development in a Kotlin project with Gradle, you may be interested in using WebJars to avoid having to also maintain a package.json and using Node. If you want to use Sass, Sass can't access the contents of these WebJars, so you have to unpack them first. Attached below is how I did this in my build.gradle.kts.

@nanodeath
nanodeath / IntersectionGlow.shader
Last active February 23, 2020 17:55
Unity Intersection Glow Shader for Orthographic Cameras
// Borrowed heavily from https://chrismflynn.wordpress.com/2012/09/06/fun-with-shaders-and-the-depth-buffer/
// Thanks Chris!
// Note that for now this only works with orthographic cameras
Shader "Intersection Glow" {
Properties
{
_HighlightColor("Highlight Color", Color) = (1, 1, 1, .5) //Color when intersecting
_HighlightThresholdMax("Highlight Threshold Max", Range(0, 0.1)) = 0.1 //Max difference for intersections
}
SubShader
@nanodeath
nanodeath / FaceCursor.cs
Created July 9, 2018 01:40
Unity: Rotating a RigidBody2D to face the cursor, smoothly
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FaceCursor : MonoBehaviour {
// 100 seems to work fine on an object with mass around 1kg.
[Tooltip("Amount of torque to apply when turning")]
public float turnSpeed;
private Rigidbody2D body;
@nanodeath
nanodeath / RecyclerViewAdapterOnListChangedCallback.kt
Last active August 7, 2020 08:14
Bind your Android data-binding ObservableList to a RecyclerView
import android.databinding.ObservableList
import android.support.v7.widget.RecyclerView
/**
* Links an [ObservableList] to a [RecyclerView], so that whenever the list is changed, the view is
* updated.
*/
class RecyclerViewAdapterOnListChangedCallback<T>(
private val adapter: RecyclerView.Adapter<*>
) : ObservableList.OnListChangedCallback<ObservableList<T>>() {
@nanodeath
nanodeath / gist:1482481
Created December 15, 2011 19:33
build-couchdb + CouchDB 1.2.x
git checkout 1.2.x
Switched to a new branch '1.2.x'
Branch 1.2.x set up to track remote branch 1.2.x from origin.
git reset --hard
HEAD is now at 7f9376c fix COUCHDB-1361 - unquoted port in js config test
git clean -f -d
git ls-files --others -i --exclude-standard | xargs rm || true
rm: missing operand
Try `rm --help' for more information.
mkdir -p ~/Downloads/build-couchdb/build/var/run/couchdb
@nanodeath
nanodeath / app_after.coffee
Created October 30, 2011 15:32
Sharing session store between http and non-http in node.js
{MemoryStore} = require('connect').session
sessionStore = new MemoryStore
app.configure ->
app.use express.session({secret: "my_super_secret", store: sessionStore})
underscore@1.2.0 /home/max/local/lib/node_modules/zanza/node_modules/underscore
log4js@0.3.9 /home/max/local/lib/node_modules/zanza/node_modules/log4js
sass@0.5.0 /home/max/local/lib/node_modules/zanza/node_modules/sass
coffee-script@1.1.2 /home/max/local/lib/node_modules/zanza/node_modules/coffee-script
run@0.1.1 /home/max/local/lib/node_modules/zanza/node_modules/run
backbone@0.5.3 /home/max/local/lib/node_modules/zanza/node_modules/backbone
bcrypt@0.4.0 /home/max/local/lib/node_modules/zanza/node_modules/bcrypt
mkdirp@0.0.7 /home/max/local/lib/node_modules/zanza/node_modules/express/node_modules/mkdirp
qs@0.3.1 /home/max/local/lib/node_modules/zanza/node_modules/express/node_modules/qs
mime@1.2.4 /home/max/local/lib/node_modules/zanza/node_modules/express/node_modules/mime
{Sword, Axe} = requireDir("./models/weapons")