Skip to content

Instantly share code, notes, and snippets.


Thomas Parslow almost

View GitHub Profile
round = 500.0;
def setup():
size(1000, 1000)
def xy(i):
global round
dist = float(i * 2);
angle = (i/((float(round)+500)))*360
x = cos(angle)*dist;
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(["", ""]);
const START_URLS = [""];
View crawler.js
// Solution
"use strict";
const url = require('url');
const rp = require("request-promise-native");
const getHrefs = require("get-hrefs");
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 /
Last active Aug 21, 2017
Problems from last night's Code Golf at Async.JS

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 /
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
almost /
Last active Jun 17, 2019 — forked from BigglesZX/
Extract frames from an animated GIF and return them from a generator, correctly handling palettes and frame update modes
import os
from PIL import Image
# Based on (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 /
Last active Sep 12, 2019
Reactive 2016 Lightning Talk Proposal: Get Flow

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.

You can’t perform that action at this time.