Skip to content

Instantly share code, notes, and snippets.

Building react apps & micro-services

Andrew Hart AndrewJHart

Building react apps & micro-services
View GitHub Profile
View es6-convert-map-to-object.js
let map = new Map();
map.set("a", 1);
map.set("b", 2);
map.set("c", 3);
let obj = [] // or Array.from(map) - either works;
.reduce((acc, [key, value]) =>
({ ...acc, [key]: value }), // Can also spread in reduce or assign, latter is quicker but I love spread syntax lol
AndrewJHart /
Created May 1, 2022 — forked from revolunet/
# Python VS JavaScript ES6 syntax comparison

Python VS ES6 syntax comparison

Python syntax here : 2.7 - online REPL

Javascript ES6 via Babel transpilation - online REPL


import math
AndrewJHart /
Created Apr 24, 2022 — forked from nornagon/
How to make a Minecraft (1.8) mod

How to make a Minecraft mod

Minecraft mods, especially mods which change the client, are by and large written with Forge. If you visit their website, you'll be greeted abruptly by a mysterious message at the top of an SMF forum, with no clear path towards actually... making a mod. I'm documenting here the steps I went through to get started, in the hopes of helping the next person have an easier time of it.

I'll be using Scala for this guide, but it should be fairly easy to adapt these instructions to any JVM language (e.g. clojure or if you're feeling masochistic, Java). I'm also developing on OS X, so some of the commands will be a little different if you're on Linux or Windows. I'm assuming you have some proficiency with your operating system, so I won't go into details about how to adapt those commands to your system.


Minecraft doesn't have an official mod API (despite early [promises](http://notch.t

AndrewJHart /
Created Apr 21, 2022 — forked from zmts/
Auto update application build version. Husky pre-commit hook.

Auto update application build version. Husky pre-commit hook.


"husky": {
    "hooks": {
      "pre-commit": "npm run build && node ./update-build.js"
AndrewJHart / netflix-remove-my-list.js
Last active Jan 10, 2022
Netflix Delete/Remove/Cleanup Your List: Simple Script to drop in browser to tidy up your queue/list of movies
View netflix-remove-my-list.js
* You can copy and paste this into your browser console and it works as of 1/1/2021 - its not pretty.
// replace "user-id" with your actual user id e.g. "123455" & same for auth url
const userId = 'my-user-id-goes-here';
const authUrl = 'auth-url-goes-here';
// first gather up all the DOM nodes in the list that have anchors w/ the title id to delete
const nodes = document.querySelectorAll('.rowList .title > a');
AndrewJHart / vanilla-ajax-poll.js
Created Sep 4, 2019 — forked from twmbx/vanilla-ajax-poll.js
Polling in JS with an async ajax call that returns a promise ( modified from: )
View vanilla-ajax-poll.js
// The polling function
function poll(fn, timeout, interval) {
var endTime = Number(new Date()) + (timeout || 2000);
interval = interval || 100;
var checkCondition = function(resolve, reject) {
var ajax = fn();
// dive into the ajax promise
ajax.then( function(response){
// If the condition is met, we're done!
AndrewJHart /
Created Feb 19, 2018 — forked from markerikson/
React "controlled" vs "uncontrolled" inputs explanation

[12:03 AM] acemarke: "controlled" and "uncontrolled" inputs
[12:04 AM] acemarke: if I have a plain, normal HTML page, and I put <input id="myTextbox" type="text" /> in my page(edited)
[12:04 AM] acemarke: and I start typing into that textbox
[12:04 AM] acemarke: it remembers what I've typed. The browser stores the current value for that input
[12:05 AM] acemarke: and then sometime later, I can get the actual element, say, const input = document.getElementById("myTextbox"), and I can ask it for its value: const currentText = input.value;
[12:05 AM] acemarke: good so far?
[12:08 AM] acemarke: I'll keep going, and let me know if you have questions
[12:08 AM] lozio: ok, actually I'm reading
[12:09 AM] lozio: good
[12:09 AM] acemarke: so, a normal HTML input field effectively stores its own value at all times, and you can get the element and ask for its value

AndrewJHart /
Last active Nov 28, 2017 — forked from nicolasembleton/
Restart Bluetooth Daemon on Mac OS X without restarting - this also works when the UI does not (preferences or menu bar)
sudo kextunload -b
sudo kextload -b
AndrewJHart /
Created Oct 17, 2017 — forked from mahmoud/
Recursively merging dictionaries with boltons.iterutils.remap. Useful for @hynek's configs.
This is an extension of the technique first detailed here:
In short, it calls remap on each container, back to front, using the accumulating
previous values as the default for the current iteration.
AndrewJHart / webpack.config.js
Created May 8, 2017 — forked from JaySpears/webpack.config.js
Webpack 2.0 Configuration with React Example
View webpack.config.js
var path = require('path');
var webpack = require('webpack');
module.exports = {
entry: [
path.resolve(__dirname, 'app/index')