Skip to content

Instantly share code, notes, and snippets.

View poying's full-sized avatar
🏠
I may be slow to respond.

Po-Ying Chen poying

🏠
I may be slow to respond.
View GitHub Profile
const R = require('ramda');
const Future = require('ramda-fantasy').Future;
// :: Int -> [Future a b] -> Future a [b]
// number of workers :: Int
// tasks to do :: [Future a b]
const batchParallel = R.curry((N, as) => {
if (0 === as.length || N < 1) {
return Future.of([]);
}
@OlegIlyenko
OlegIlyenko / Event-stream based GraphQL subscriptions.md
Last active February 24, 2024 04:41
Event-stream based GraphQL subscriptions for real-time updates

In this gist I would like to describe an idea for GraphQL subscriptions. It was inspired by conversations about subscriptions in the GraphQL slack channel and different GH issues, like #89 and #411.

Conceptual Model

At the moment GraphQL allows 2 types of queries:

  • query
  • mutation

Reference implementation also adds the third type: subscription. It does not have any semantics yet, so here I would like to propose one possible semantics interpretation and the reasoning behind it.

@simonh1000
simonh1000 / ArchictectureErrorHandler.elm
Created September 23, 2015 08:06
Elm architecture example with Http (Json parsing) error handling
module ArchictectureErrorHandler where
import Text exposing (fromString)
import String
import Json.Decode as Json exposing (..)
import StartApp exposing (start)
import Html exposing (..)
import Http exposing (get, Error)
import Effects exposing (Effects)
@bensu
bensu / Dropdown.elm
Created August 19, 2015 19:52
Dropdown Component in Elm
module Dropdown where
import List exposing (..)
import Html exposing (..)
import Html.Attributes exposing (style)
import Html.Events exposing (onClick, onBlur)
-- MODEL
@mgold
mgold / using_mailboxes_in_elm.md
Last active March 24, 2020 16:05
Using Mailboxes in Elm: a tutorial blog post

Using Mailboxes in Elm

Max Goldstein | July 30, 2015 | Elm 0.15.1

In Elm, signals always have a data source associated with them. Window.dimensions is exactly what you think it is, and you can't send your own events on it. You can derive your own signals from these primitives using map, filter, and merge, but the timing of events is beyond your control.

This becomes a problem when you try to add UI elements. We want to be able to add checkboxes and dropdown menus, and to receive the current state of these elements as a signal. So how do we do that?

The Bad Old Days

@imjasonh
imjasonh / markdown.css
Last active February 12, 2024 17:18
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
@ericelliott
ericelliott / essential-javascript-links.md
Last active April 22, 2024 10:15
Essential JavaScript Links
@conancat
conancat / attictv.jobs.md
Last active June 9, 2016 03:20
HIRING: Android, iOS, Backend/JavaScript developers and System Administrator. Find out more below!

HIRING: Android, iOS, Backend/JavaScript developers and System Administrator

Position: Full-time/Part-time

  • Roles: Android, iOS, Backend developers and System Administrator
  • Full-time and part-time positions available!
@dgraham
dgraham / fetch.js
Last active March 24, 2023 15:44
Simple window.fetch wrapper.
(function() {
function status(response) {
if (response.ok) {
return response
} else {
var error = new Error(response.statusText || response.status)
error.response = response
throw error
}
}
@addyosmani
addyosmani / README.md
Last active April 2, 2024 20:18 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version