Skip to content

Instantly share code, notes, and snippets.

@staltz
staltz / introrx.md
Last active May 12, 2025 23:22
The introduction to Reactive Programming you've been missing
@evancz
evancz / Architecture.md
Last active December 21, 2022 14:28
Ideas and guidelines for architecting larger applications in Elm to be modular and extensible

Architecture in Elm

This document is a collection of concepts and strategies to make large Elm projects modular and extensible.

We will start by thinking about the structure of signals in our program. Broadly speaking, your application state should live in one big foldp. You will probably merge a bunch of input signals into a single stream of updates. This sounds a bit crazy at first, but it is in the same ballpark as Om or Facebook's Flux. There are a couple major benefits to having a centralized home for your application state:

  1. There is a single source of truth. Traditional approaches force you to write a decent amount of custom and error prone code to synchronize state between many different stateful components. (The state of this widget needs to be synced with the application state, which needs to be synced with some other widget, etc.) By placing all of your state in one location, you eliminate an entire class of bugs in which two components get into inconsistent states. We also think yo
@grugq
grugq / gist:03167bed45e774551155
Last active April 15, 2025 11:22
operational pgp - draft

Operational PGP

This is a guide on how to email securely.

There are many guides on how to install and use PGP to encrypt email. This is not one of them. This is a guide on secure communication using email with PGP encryption. If you are not familiar with PGP, please read another guide first. If you are comfortable using PGP to encrypt and decrypt emails, this guide will raise your security to the next level.

@mflux
mflux / twojshack.js
Created September 25, 2014 05:55
TWO.js text hack
/*
Goes after
Polygon.MakeObservable(Polygon.prototype);
//...
*/
var Text = Two.Text = function( text ) {
@jongacnik
jongacnik / breakpoints.js
Last active August 29, 2015 14:08
Breakpoints module
/**
* Functionality:
* - adds breakpoint attributes to body & fires callbacks
*
* todo: callback params, height, matchMedia?
*/
var extend = require('extend');
var _data = {
currentBreakpoints : [],
@kylemcdonald
kylemcdonald / differences.txt
Last active August 29, 2015 14:10
Results for Google autocomplete of the phrase "Is there a difference between..." followed by different letters, for English in the USA.
a break and a fracture
a buffalo and a bison
a college and a university
a sweet potato and a yam
a violin and a fiddle
add and adhd
almond flour and almond meal
alzheimer's and dementia
an attorney and a lawyer
autumn and fall
@bendc
bendc / functional-utils.js
Last active September 15, 2023 12:12
A set of pure ES2015 functions aimed to make functional JavaScript more idiomatic.
// array utils
// =================================================================================================
const combine = (...arrays) => [].concat(...arrays);
const compact = arr => arr.filter(Boolean);
const contains = (() => Array.prototype.includes
? (arr, value) => arr.includes(value)
: (arr, value) => arr.some(el => el === value)

Folder Structure

Please note

While this gist has been shared and followed for years, I regret not giving more background. It was originally a gist for the engineering org I was in, not a "general suggestion" for any React app.

Typically I avoid folders altogether. Heck, I even avoid new files. If I can build an app with one 2000 line file I will. New files and folders are a pain.

@jongacnik
jongacnik / object-fitter.js
Last active August 29, 2015 14:18
Object Fitter — Test element against an aspect ratio, depending on result add handy attribute to elements
var iselement = require('is-element')
module.exports = function(opts) {
var testRatio
if (iselement(opts.tester)) {
testRatio = opts.tester.clientHeight / opts.tester.clientWidth
} else {
testRatio = window.innerHeight / window.innerWidth
@gunjanpatel
gunjanpatel / amazon-ec2-ftp.md
Last active October 10, 2023 15:31
amazon ec2 LAMP and FTP installation and setup