Skip to content

Instantly share code, notes, and snippets.

@jeremyckahn
jeremyckahn / react-app-architecture.md
Last active November 6, 2018 17:06
Proposal for a simpler React application architecture

Proposal for a simpler React application architecture

This is a design document for a minimalist React application architecture. Anecdotally, this design is proving to work well for smaller-to-medium scale projects, but it has not been proven to work for large-scale projects because it has not been tested against those yet.

This design is modeled around the official Intro To React guide put out by the React team. In fact, it does not diverge in any significant way from that guide; it simply adds a few explicit constraints to promote simpler implementations.

Examples of this architecture in use:

@jeremyckahn
jeremyckahn / 1-getting-started-with-unit-tests.md
Last active April 9, 2018 14:58
Getting Started With Unit Tests

Getting Started With Unit Tests

This is not meant to be a comprehensive guide to testing, but rather a high-level introduction. It is meant to help you become conversant in unit testing, not a master. That will come later!

Case Study: rekapi-timeline's computeHighlightedKeyframe and computeDescaledPixelPosition functions:

@jeremyckahn
jeremyckahn / news-proxy.php
Last active October 2, 2020 20:49
newsapi.org PHP proxy
<?php
header('Content-type: text/json');
header('Access-Control-Allow-Origin: *');
$url = 'https://newsapi.org/v2/top-headlines?'
. $_SERVER['QUERY_STRING']
. '&apiKey=[YOUR API KEY GOES HERE]';
$curl = curl_init();
@jeremyckahn
jeremyckahn / cs.md
Last active June 21, 2026 12:51
Practical Computer Science Fundamentals

Practical Computer Science Fundamentals

CompSci degrees cost a lot of money, take a lot of time, and aren't a viable option for a lot of folks. Luckily, much of what you'll learn in a proper Computer Science program can be self-taught online for free. This gist is a roundup of some of the most helpful resources I've found.

Where I'm coming from

I'm not pursuing a deep, academic comprehension of CS concepts — my goal is to become respectably conversant about the most prevalent and relevant subjects in the field.

Starting points

@jeremyckahn
jeremyckahn / fetchJson.js
Last active November 2, 2017 21:25
A localstorage-backed cache wrapper for window.fetch
const fetchJson = (function () {
localStorage.cachedFetchResponses = localStorage.cachedFetchResponses || '{}';
let cache = localStorage.cachedFetchResponses;
const setCachedData = (key, data) => {
const parsedCache = JSON.parse(cache);
parsedCache[key] = data;
try {
@jeremyckahn
jeremyckahn / index.html
Created October 31, 2017 19:02
Playing with React
<div id="app">
{
"a": 1,
"b": 2,
"c": {
"d": 3,
"e": {
"f": 4,
"g": [
5,
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@jeremyckahn
jeremyckahn / generateBoilerplatedKeyframes.es5.js
Created July 14, 2017 12:57
What going from ES5 to ES6 can look like
/*!
* @param {Rekapi.Actor} actor
* @param {string} animName
* @param {number} steps
* @param {boolean} doCombineProperties
* @param {Array.<string>=} opt_vendors
* @return {string}
*/
function generateBoilerplatedKeyframes (
more productive
comfortable
not drinking too much
regular exercise at the gym (3 days a week)
getting on better with your associate employee contemporaries
at ease
eating well (no more microwave dinners and saturated fats)
a patient better driver
a safer car (baby smiling in back seat)
sleeping well (no bad dreams)