Skip to content

Instantly share code, notes, and snippets.

View firebaseDatabaseSet.js
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 Jan 25, 2018
Stack Overflow Help
View index.js
// 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);
View DockerCommands.sh
# 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 Jun 15, 2020
Git aliases I use on a day-to-day basis
View Git Aliases
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>
View gist:397a73e64b8aeb56e9c484e94b8c1d82

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 {