Skip to content

Instantly share code, notes, and snippets.

const client = require('firebase-tools');
client.database.set('/', './mockData/db.json', {
project: 'my-test-project',
token: process.env.FIREBASE_TOKEN,
cwd: './'
});
@JamWils
JamWils / index.js
Created January 25, 2018 14:45
Stack Overflow Help
// For help with question at https://stackoverflow.com/questions/48427217/nodejs-reading-file-does-not-work
const fs = require('fs');
const path = require('path');
console.log('beforereadfile');
fs.readFile(path.join('.', '/test.json'), 'utf8', function (err, data) {
if (err) {
console.log('Error loading client secret file: ' + err);
# Delete all exited containers
docker rm $(docker ps -q -f status=exited)
# Delete all images with no tags
docker rmi $(docker images -q -f "dangling=true")
# Plugins -> Network
docker info
# Create a new network
@JamWils
JamWils / Git Aliases
Last active June 15, 2020 17:28
Git aliases I use on a day-to-day basis
git config --global alias.s "status -s"
git config --global alias.bc="branch --sort=-committerdate"
git config --global alias.lg "log --oneline --decorate --graph"
git config --global alias.lgb "log --graph --oneline --decorate --first-parent"
// Calling log for branch
git lgb <branch_name>
@JamWils
JamWils / gist:397a73e64b8aeb56e9c484e94b8c1d82
Last active August 6, 2021 19:49
Golang: Interface vs Struct

Golang: Interface vs Struct

Some one asked me the question, how do you decide when to make an interface vs just instantiating a struct?

Honestly, this is not a perfect answer, but here are some simple guidelines that I would follow when creating an interface or just creating a simple struct.

Let's start with a simple object Person. There is nothing astronomical about the object and it contains some simple information. Here there isn't much to create

type Person struct {
@JamWils
JamWils / UnityPhysicsRayCastTest.cs
Last active September 13, 2023 09:27
This is some sample code on how to test Unity Physics properly, this uses version 1.0.14. This sets up a sphere collider and draw a ray through the center of it along the y-axis. Please note the `LocalTransform` component, this needs to be included for the collider to work properly in a unit test.
// Original credit: https://forum.unity.com/threads/testing-systems-performing-raycasts.1031335/
public class BaseSystemTest : ECSTestsFixture {
protected EntityManager entityManager;
protected SystemHandle physicsWorldSystem;
protected SystemHandle collisionWorldSystem;
[SetUp]
public override void Setup() {
base.Setup();