Skip to content

Instantly share code, notes, and snippets.

View michaelmcshinsky's full-sized avatar

Michael McShinsky michaelmcshinsky

View GitHub Profile
@michaelmcshinsky
michaelmcshinsky / app.js
Created January 17, 2022 04:16
Change AngularJS navigation route without reload
'use strict';
angular
.module('app', [])
.config([])
.run(['$location', '$route'], function () {
const original = $location.path;
$location.path = function (path, reload) {
if (reload === false) {
const lastRoute = $route.current;
@michaelmcshinsky
michaelmcshinsky / api-core.js
Last active December 8, 2023 13:51
A comprehensive starter solution to making API calls structured and manageable in code architecture and development teams.
import apiProvider from './provider';
export class ApiCore {
constructor(options) {
if (options.getAll) {
this.getAll = () => {
return apiProvider.getAll(options.url);
};
}
@michaelmcshinsky
michaelmcshinsky / remove_node_modules_recursively.ps1
Created July 12, 2020 23:49 — forked from SynCap/remove_node_modules_recursively.ps1
Remove `node_modules` folders in Windows in all subfolders recursively with PowerShell to avoid exceeding path max_length
<#
Note: Eliminate `-WhatIf` parameter to get action be actually done
Note: PS with version prior to 4.0 can't delete non-empty folders
#>
Get-ChildItem -Path "." -Include "node_modules" -Recurse -File:$false | Remove-Item -Recurse -Force -WhatIf
@michaelmcshinsky
michaelmcshinsky / 00-benchmarking-javascript-loops-part-1.js
Last active June 16, 2020 12:56
Benchmarking Javascript Loops and Methods
//
let obj1 = { firstName: 'John', lastName: 'Doe', email: 'johnydoe1@domain.com' };
let obj2 = { email: 'john.doe@domain.com', phone: '012–345–6789' };
let obj3 = { city: 'Salt Lake City', state: 'Utah' }
function merge(…arr) {
return arr.reduce((acc, cur) => {
// Can add custom logic for how keys or nested values should be handled.
for (let key in cur) {
let obj1 = { firstName: 'John', lastName: 'Doe', email: 'johnydoe1@domain.com' };
let obj2 = { email: 'john.doe@domain.com', phone: '012–345–6789' };
let obj3 = { city: 'Salt Lake City', state: 'Utah' }
let newObj = Object.assign({}, obj1, obj2, obj3);
// {
// firstName: 'John',
let obj1 = { firstName: 'John', lastName: 'Doe', email: 'johnydoe1@domain.com' };
let obj2 = { email: 'john.doe@domain.com', phone: '012–345–6789' };
let obj3 = { city: 'Salt Lake City', state: 'Utah' }
let newObj = {…obj1, …obj2, …obj3};
// {
// firstName: 'John',
@michaelmcshinsky
michaelmcshinsky / education-dropdown.html
Created December 30, 2019 13:32 — forked from ag14spirit/education-dropdown.html
Form education drop down list
<fieldset>
<legend>Education</legend>
<select class="form-control dropdown" id="education" name="education">
<option value="" selected="selected" disabled="disabled">-- select one --</option>
<option value="No formal education">No formal education</option>
<option value="Primary education">Primary education</option>
<option value="Secondary education">Secondary education or high school</option>
<option value="GED">GED</option>
<option value="Vocational qualification">Vocational qualification</option>
<option value="Bachelor's degree">Bachelor's degree</option>
@michaelmcshinsky
michaelmcshinsky / countries.json
Last active December 12, 2019 20:46 — forked from keeguon/countries.json
A list of countries in JSON
[
{
"name": "Afghanistan",
"code": "AF"
},
{
"name": "Åland Islands",
"code": "AX"
},
{
@michaelmcshinsky
michaelmcshinsky / states-array.json
Last active December 12, 2019 21:05 — forked from mshafrir/states_hash.json
US states in JSON form
[
{
"name": "Alabama",
"abbreviation": "AL"
},
{
"name": "Alaska",
"abbreviation": "AK"
},
{