Skip to content

Instantly share code, notes, and snippets.

Working from home

Andrew Hart AndrewJHart

Working from home
View GitHub Profile
AndrewJHart / netflix-remove-my-list.js
Last active Jan 11, 2021
Delete/Remove Netflix My List or add a filter and keep some titles
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')
AndrewJHart / emitter.service.ts
Created Feb 11, 2017 — forked from sasxa/emitter.service.ts
Angular2 Communicating between sibling components
View emitter.service.ts
import {Injectable, EventEmitter} from 'angular2/core';
export class EmitterService {
private static _emitters: { [ID: string]: EventEmitter<any> } = {};
static get(ID: string): EventEmitter<any> {
if (!this._emitters[ID])
this._emitters[ID] = new EventEmitter();
return this._emitters[ID];
AndrewJHart /
Created Apr 13, 2016
JWT authentication middleware for django rest framework that populates the request.user object
from django.utils.functional import SimpleLazyObject
from django.contrib.auth.models import AnonymousUser
from rest_framework.request import Request
from rest_framework_jwt.authentication import JSONWebTokenAuthentication
def get_user_jwt(request):
Replacement for django session auth get_user & auth.get_user for
AndrewJHart / .env
Created Mar 18, 2016 — forked from allanlei/.env
Sample local Heroku/Django development environment using foreman
View .env
class DynamicFieldsMixin(object):
A serializer mixin that takes an additional `fields` argument that controls
which fields should be displayed.
class MySerializer(serializers.HyperlinkedModelSerializer, DynamicFieldsMixin):
class Meta:
model = MyModel