Skip to content

Instantly share code, notes, and snippets.

View median-man's full-sized avatar

John Desrosiers median-man

  • El Cajon, CA USA
View GitHub Profile
@median-man
median-man / practice-problems.md
Last active December 5, 2017 14:52
Collection of practice problems for learning Javascript and jQuery.

Practice Problems

Collection of practice problems for learning jQuery.

Count Down

Using html and Javascript, display a count down timer that counts down from 5. The count should decrease by one every second. When the count reaches 0, display the message "Times Up!".

One possible solution may be viewed on CodePen.io here

Buttons From Array

@median-man
median-man / rm_node_modules.sh
Created January 11, 2018 22:05
Remove all node_modules folders recursively.
# removes all node_modules folders recursively
find . -name "node_modules" -exec rm -rf '{}' +
# I found this command on Coderwall at
# https://coderwall.com/p/guqrca/remove-all-node_module-folders-recursively
/*
Usage:
Create an instance of the class passing a selector string, callback for handling shift + click
on element completing a range, and a callback for handling a click on a single element.
The selector is a string passed to document.querySelector to set the container for the shiftGroup.
The onGroupClick callback is passed the original event object and an array containing the range
of selected elements.
@median-man
median-man / .gitmessage
Last active September 19, 2024 14:09 — forked from adeekshith/.git-commit-template.txt
This commit message template helps you write **useful** commit messages.
# <type>: <subject> (Max 50 char, Why is this change necessary?)
# |<---- Using a Maximum Of 50 Characters ---->|
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
# Explain how the commit addresses the issue
# IMPORTANT!! Describe any side effects of the change.
# Provide links or keys to any relevant tickets, articles or other resources
# Examples: "Jira issue [ABC-123]" or "Closes Github issue #123"
//see if sequence of nums is in increasing order, but seq is allowed to decrease once.
// The Goldilocks solution
function checkSequence(arr) {
const maxOutOfSequencePermitted = 1
let countOfOutOfSequence = 0
for (let i = 1; i < arr.length; i += 1) {
if (arr[i] < arr[i - 1]) {
countOfOutOfSequence += 1
}
@median-man
median-man / insurance-app.js
Created September 29, 2019 14:29
Basic Redux Example
/*
This is a copy/paste from codepen.io. (https://codepen.io/john-desrosiers/pen/vYBwjrG?editors=0010)
The revealing module pattern with IIFE is used since only a single js file is used for the pen.
*/
const { createStore, combineReducers } = Redux
const actionTypes = Object.freeze({
CREATE_POLICY: 'create insurance policy',
DELETE_POLICY: 'cancel insurance policy',
CREATE_CLAIM: 'make an insurance claim'
@median-man
median-man / readme.md
Last active October 16, 2019 13:06
MongoDB: Complete Uninstall

Completely Uninstall MongoDB

Windows 10

  • Press the windows key
  • Type type "add or remove programs" until "Add or remove programs" is displayed
  • Choose "Add or remove programs" (click or press Enter)
  • Type "mongodb" in the "Search this list" input box.
  • Click on "MongoDB x.x.xx ..." and then click "Uninstall"
@median-man
median-man / javascript.json
Last active November 8, 2019 14:45
VSCode User Snippets
{
"react component": {
"description": "A functional react component file template.",
"prefix": ["re", "rc", "react-comp", "comp"],
"body": [
"import React from \"react\"",
"",
"const ${1:ComponentName} = () => <div>${1:ComponentName} Component</div>",
"",
"export default ${1:ComponentName}",
@median-man
median-man / mongodb-mac-uninstall.md
Last active October 24, 2024 16:38
Uninstall MongoDB on Mac