Skip to content

Instantly share code, notes, and snippets.

View jhwheeler's full-sized avatar

Jackson Holiday Wheeler jhwheeler

View GitHub Profile
export function checkArrayElementsEquality (initialArray, comparedArray) {
if (!initialArray || !comparedArray) return false
if (initialArray.length !== comparedArray.length) return false
const superSet = {}
for (let i = 0; i < initialArray.length; i++) {
const element = initialArray[i] + typeof initialArray[i]
superSet[element] = 1
@jhwheeler
jhwheeler / async-foreach.js
Created August 2, 2018 08:16 — forked from atinux/async-foreach.js
JavaScript: async/await with forEach()
const waitFor = (ms) => new Promise(r => setTimeout(r, ms))
const asyncForEach = (array, callback) => {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array)
}
}
const start = async () => {
await asyncForEach([1, 2, 3], async (num) => {
await waitFor(50)
@jhwheeler
jhwheeler / zoho.js
Last active July 19, 2017 07:00
Zoho API function
const AUTH_TOKEN = process.env.AUTH_TOKEN;
const API_URL = `https://cors-anywhere.herokuapp.com/https://crm.zoho.com/crm/private/xml/Leads/insertRecords?newFormat=1&authtoken=${AUTH_TOKEN}&scope=crmapi`;
const zoho = (answers, result) => {
const request =
`<Leads>
<row no="1">
<FL val="Lead Source">Loans Only App</FL>
<FL val="Business Arm">Loans Only</FL>
@jhwheeler
jhwheeler / Blueprint.js
Created June 8, 2017 21:30
Blueprint component draft
import React, { Component } from 'react';
import { connect } from 'react-redux';
import Hero from '../Hero/Hero';
import { fetchAnswers } from '../../actions/answerActions';
import css from './Blueprint.scss';
import { copy } from './Blueprint.data.js';
class Blueprint extends Component {
@jhwheeler
jhwheeler / language-learning-techniques.md
Last active October 5, 2024 18:19
Efficient and effective language learning techniques: Shadowing, Scriptorium, and Side-by-Side Reading.

Language Learning Techniques

Some of the techniques I've used to learn languages quickly and thoroughly:

  1. Shadowing

  2. Scriptorium

  3. Side-by-Side Reading

@jhwheeler
jhwheeler / thirdBit.js
Last active May 27, 2017 18:04
Binary and Bitwise Drills
const num = parseInt(process.argv[2], 10);
const newBit = parseInt(process.argv[3], 2);
const thirdBit = num => {
const binNum = num.toString(2);
const binNumArr = binNum.split('');
binNumArr.splice(2, 1, newBit);
console.log(binNumArr);
return binNumArr
}
@jhwheeler
jhwheeler / bigONotation.js
Last active December 24, 2024 02:50
Big O Notation Exercises
// 1. Even or odd
function isEven(value){
if (value % 2 == 0){
return true;
}
else
return false;
}

Mongo Shell Drills

Get All

Find the command that retrieves all restaurants.

> db.restaurants.find();

Limit and Sort

Find the command that makes the first 10 restaurants appear when db.restaurants is alphabetically sorted by the name property.