Skip to content

Instantly share code, notes, and snippets.

Avatar

Jackson Holiday Wheeler jhwheeler

View GitHub Profile
View checkArrayElementsEquality.js
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 Aug 2, 2018 — forked from Atinux/async-foreach.js
JavaScript: async/await with forEach()
View async-foreach.js
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 Jul 19, 2017
Zoho API function
View zoho.js
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 Jun 8, 2017
Blueprint component draft
View Blueprint.js
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 Dec 21, 2020
Efficient and effective language learning techniques: Shadowing, Scriptorium, and Side-by-Side Reading.
View language-learning-techniques.md

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
Binary and Bitwise Drills
View thirdBit.js
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 Jun 22, 2021
Big O Notation Exercises
View bigONotation.js
// 1. Even or odd
function isEven(value){
if (value % 2 == 0){
return true;
}
else
return false;
}
View mongo-shell-drills.md

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.