Skip to content

Instantly share code, notes, and snippets.

@sadasant
sadasant / foldWhile.mkd
Last active August 28, 2021 10:27
Recursive fold takeWhile (as in haskell)

Recursive fold takeWhile (as in haskell). Lazy evaluated!

  • Iterates depth-first every element of a nested data structure given as obj.
  • Runs only while the iterator fn returns true.
  • The fn iterator receives:
    • An accumulator, that by default is an array, but that can be defined as anything else in the third parameter given to foldWhile.
    • The next value iterated.
@jdjkelly
jdjkelly / gist:0bddf2e834b6d6bc2174
Last active December 25, 2021 14:30
Making Accessible Ember Components

Making Accessible Ember Components

Making the web accessible is important. We have ethical and, in some cases, legal obligations to ensuring access to all of users.

Luckily for us, it's easy to make an accessible Ember Component.

What are components?

To understand the accessibility story around Ember Components, we have to start by talking about Web Components. Ember Components are designed to be interoperable with the final Web Components API.

@staltz
staltz / introrx.md
Last active April 19, 2025 05:15
The introduction to Reactive Programming you've been missing
require 'socket'
module EventEmitter
def _callbacks
@_callbacks ||= Hash.new { |h, k| h[k] = [] }
end
def on(type, &blk)
_callbacks[type] << blk
self
@mshafrir
mshafrir / states_hash.json
Created May 9, 2012 17:05
US states in JSON form
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",