Skip to content

Instantly share code, notes, and snippets.

Thomas Parslow almost

Block or report user

Report or block almost

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View tree-iterator.js
class Tree {
constructor(value, left, right) {
this.left = left;
this.value = value;
this.right = right;
}
}
View crawler-solution.js
"use strict";
const url = require("url");
const rp = require("request-promise-native");
const getHrefs = require("get-hrefs");
const MAX_CONCURRENT = 10;
const MAX_COUNT = 2000;
const ALLOW_DOMAINS = new Set(["almostobsolete.net", "tomparslow.co.uk"]);
const START_URLS = ["http://almostobsolete.net/"];
View crawler.js
// Solution https://gist.github.com/almost/9ee99b1a3e7fa240c596be3820c0b6b0
"use strict";
const url = require('url');
const rp = require("request-promise-native");
const getHrefs = require("get-hrefs");
const MAX_CONCURRENT = 3;
const MAX_COUNT = 5;
View WithDimensions.js
// @flow
import React, { Component } from "react";
import { Dimensions } from "react-native";
type DimensionsState = { window: { width: number, height: number } };
type Props = {
children: (dimensions: DimensionsState) => React.Element<*>
};
View gist:ef7eceac380209961ae6681c5c95282d
UPDATE: The 1 can be either LEFT aligned (as shown) or RIGHT aligned, either will be accepted
###
# #
# #
# #
###
#
#
@almost
almost / codegolf.md
Last active Aug 21, 2017
Problems from last night's Code Golf at Async.JS
View codegolf.md

Yes? No?

Make a function (named 'play') that takes a boolean (true or false) and returns the string 'y' (for true) or 'n' (for false)

To the power of JavaScript

Make a function that takes a number between 1 and 30 and returns 2 raised to the power of that number. (you can use ES2015 but nothing beyond that)

@almost
almost / learning-timetable.md
Created Jul 2, 2016
My plan for the next 2 weeks of solid learning. I doubt I'll stick to it exactly but it gives me a framework to start with
View learning-timetable.md
@almost
almost / gifextract.py
Last active Jun 17, 2019 — forked from BigglesZX/gifextract.py
Extract frames from an animated GIF and return them from a generator, correctly handling palettes and frame update modes
View gifextract.py
import os
from PIL import Image
# Based on https://gist.github.com/BigglesZX/4016539 (but adapted to be a
# generator that yields frames instead of a function that saves out frames)
'''
I searched high and low for solutions to the "extract animated GIF frames in Python"
problem, and after much trial and error came up with the following solution based
on several partial examples around the web (mostly Stack Overflow).
@almost
almost / proposal.md
Last active Sep 12, 2019
Reactive 2016 Lightning Talk Proposal: Get Flow
View proposal.md

This is a proposal for a lightning talk at the Reactive 2016 conference.

NOTE: If you like this, star ⭐️ the Gist - the amount of stars decides whether it makes the cut! You could also Retweet if you want :)

Get Flow

Type checking JavaScript with Flow

JavaScript is a dynamic language, and there's nothing wrong with that. It allows quick iteration and lowers barriers. However, sometimes some compile-time type checking is just what you need to keep your code in line and give yourself the confidence to build bigger and faster. Flow gives the best of both worlds. You can have normal JavaScript but you can also add types where they're helpful, and it adds zero cost at runtime. In this talk I'll show Flow as it applies to a Redux & React codebase.

@almost
almost / notebook.sh
Last active Apr 16, 2018 — forked from yangj1e/notebook.sh
Deploy Jupyter Notebook server
View notebook.sh
#!/usr/bin/env bash
cd ~
wget http://repo.continuum.io/archive/Anaconda3-4.1.0-Linux-x86_64.sh
bash Anaconda3-4.1.0-Linux-x86_64.sh -b
echo 'PATH="/home/ubuntu/anaconda2/bin:$PATH"' >> .bashrc
. .bashrc
jupyter notebook --generate-config
You can’t perform that action at this time.