Skip to content

Instantly share code, notes, and snippets.

View ShaunSHamilton's full-sized avatar
🏠
Working from home

Shaun Hamilton ShaunSHamilton

🏠
Working from home
View GitHub Profile
# Place file within Windows' root user
[wsl2]
memory=24GB
@ShaunSHamilton
ShaunSHamilton / .bashrc
Created April 14, 2023 12:45
Oh-My-Bash Config
# Enable the subsequent settings only in interactive sessions
case $- in
*i*) ;;
*) return;;
esac
# Path to your oh-my-bash installation.
export OSH='/home/shauh/.oh-my-bash'
# Set name of the theme to load. Optionally, if you set this to "random"
@ShaunSHamilton
ShaunSHamilton / routes.md
Last active November 3, 2022 20:07
freeCodeCamp REST API routes

Routes

Current

api-server

/user

  • GET /account
@ShaunSHamilton
ShaunSHamilton / euler-rust.md
Created February 28, 2022 23:42
How to run freeCodeCamp Euler Problems in Rust

How to Run the Project Euler Problems Locally in VSCode

First, you'll need to download and install the freeCodeCamp Courses VSCode extension.

Then, in an empty workspace, open the VSCode command palette with Ctrl/Cmd + Shift + P.

euler-rust-local-ext-1

Select the command freeCodeCamp: Open Course.

@ShaunSHamilton
ShaunSHamilton / client.js
Last active October 7, 2022 17:17
Advanced Node and Express - Send and Display Chat Messages
$(document).ready(function () {
/*global io*/
let socket = io();
socket.on('user', data => {
$('#num-users').text(data.currentUsers + ' users online');
let message =
data.username +
(data.connected ? ' has joined the chat.' : ' has left the chat.');
$('#messages').append($('<li>').html('<b>' + message + '</b>'));
@ShaunSHamilton
ShaunSHamilton / client.js
Last active October 7, 2022 17:12
Advanced Node and Express - Announce New Users
$(document).ready(function () {
/* Global io */
let socket = io();
socket.on('user', (data) => {
$('#num-users').text(data.currentUsers + ' users online');
let message = data.username + (data.connected ? ' has joined the chat.' : ' has left the chat.');
$('#messages').append($('<li>').html('<b>' + message + '</b>'));
});
@ShaunSHamilton
ShaunSHamilton / server.js
Last active October 7, 2022 17:02
Advanced Node and Express - Authentication with Socket.IO
'use strict';
require('dotenv').config();
const express = require('express');
const myDB = require('./connection');
const fccTesting = require('./freeCodeCamp/fcctesting.js');
const session = require('express-session');
const passport = require('passport');
const routes = require('./routes.js');
const auth = require('./auth.js');
@ShaunSHamilton
ShaunSHamilton / server.js
Last active October 7, 2022 17:00
Advanced Node and Express - Handle a Disconnect
'use strict';
require('dotenv').config();
const express = require('express');
const myDB = require('./connection');
const fccTesting = require('./freeCodeCamp/fcctesting.js');
const session = require('express-session');
const passport = require('passport');
const routes = require('./routes.js');
const auth = require('./auth.js');
@ShaunSHamilton
ShaunSHamilton / client.js
Last active October 17, 2022 13:55
Advanced Node and Express - Communicate by Emitting
$(document).ready(function () {
/*global io*/
let socket = io();
socket.on('user count', function (data) {
console.log(data);
});
// Form submittion with new message in field with id 'm'
$('form').submit(function () {
@ShaunSHamilton
ShaunSHamilton / client.js
Last active October 17, 2022 13:55
Advanced Node and Express - Set up the Environment
$(document).ready(function () {
/*global io*/
let socket = io();
// Form submittion with new message in field with id 'm'
$('form').submit(function () {
var messageToSend = $('#m').val();
$('#m').val('');
return false; // prevent form submit from refreshing page