Skip to content

Instantly share code, notes, and snippets.

@niamurrell
niamurrell / cloudSettings
Last active January 22, 2020 00:55
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-01-22T00:55:14.384Z","extensionVersion":"v3.4.3"}
const { ApolloServer, gql } = require('apollo-server');
const lifts = require("./data/lifts.json");
const trails = require("./data/trails.json");
const typeDefs = gql`
type Lift {
id: ID!
name: String!
status: LiftStatus
@niamurrell
niamurrell / .gitignore
Created September 30, 2018 19:15
Boilerplate starter for .gitignore
# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
@niamurrell
niamurrell / .bash-git-color-prompt
Last active May 29, 2018 01:24
Set colors, create function to get current git branch, and export prompt script to command line
# Colors
Color_Off="\[\033[0m\]" # Text Reset
Blue="\[\033[0;34m\]" # Blue
Cyan="\[\033[0;36m\]" # Cyan
BrightBlue="\[\033[0;94m\]" # Bright Blue
# Git branch function
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
@niamurrell
niamurrell / dbServer2.js
Created December 14, 2017 05:00
Runs a Node.js server which stores/retrieves data in txt file based on URL params
var http = require("http");
var url = require("url");
var fs = require("fs");
var db = {};
var handleRequest = function(req, res) {
res.writeHead(200, {"Content-Type": "text/plain"});
console.log("Request was made to URL: " + req.url);
// Get URL params
@niamurrell
niamurrell / dbServer.js
Created December 10, 2017 23:16
Runs a Node.js server which stores/retrieves data in memory based on URL params
var http = require("http");
var url = require("url");
var db = {};
var handleRequest = function(req, res) {
res.writeHead(200, {"Content-Type": "text/plain"});
console.log("Request was made to URL: " + req.url);
// Get URL params
var parsedUrl = url.parse(req.url, true);
@niamurrell
niamurrell / restful.md
Last active July 23, 2017 19:51
RESTful Routing with DB Methods
Name URL Request Type Description MongoDB Method Sequelize Method
INDEX /posts GET Display list of all posts Post.find() Post.findAll()
NEW /posts/new GET Display form to make new post n/a n/a
CREATE /posts POST Add new post to database Post.create() Post.create()
SHOW /posts/:id GET Show info about specific post Post.findById() Post.findById()
EDIT /posts/:id/edit GET Show edit form for specific post Post.findById() Post.findById()
UPDATE /posts/:id PUT Update specific post & reroute to edited post Post.findByIdAndUpdate() Post.update()
DESTROY /posts:id DELETE Delete specific post & reroute Post.findByIdAndRemove() Post.destroy()
@niamurrell
niamurrell / README-Template.md
Created July 14, 2017 05:22 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites