Skip to content

Instantly share code, notes, and snippets.

View mullaney's full-sized avatar
💭
Coding at HLT

Kevin Kelly mullaney

💭
Coding at HLT
View GitHub Profile
@mullaney
mullaney / with_indifferent_access.md
Last active January 15, 2019 22:57
With Indifferent Access - Symbols and Strings as keys in Rails

With Indifferent Access - Symbols and Strings as keys in Rails

When I first started using Ruby on Rails, I did not have a deep understanding of how hashes worked or the difference between keys that are symbols (:my_key) and keys which are strings ('my_other_key'). I assumed wrongly that symbols were simply aliases of strings that the following lines of code were equivalent:

my_hash['key'] = 'my value'
my_hash[:key] = 'my value'

They aren't, of course. Those two lines of code establish two different key / value pairs. And if you print the my_hash, you get this:

Git Cheat Sheet

Basic commands

git init Creates a new git repository in the directory

git add <file name> Adds a specific file to staging

git add . or git add -A Adds the full directory and its contents to staging

@mullaney
mullaney / issues-and-branches.md
Last active March 8, 2018 22:01
Git Branch Cycle

Git Branch Cycle

Ready to tackle an issue? It's time to start working on branches

Step 1 - Make sure your master is up to date

git checkout master
git pull
@mullaney
mullaney / app.js
Created January 7, 2018 02:40
Express app.js template
const express = require('express');
const app = express();
// port for local dev server
const port = 3000;
// for css/js/img assets and for any static files
app.use(express.static("public"));
// using ejs html templates in the views/ folder