Skip to content

Instantly share code, notes, and snippets.

View shrynx's full-sized avatar
🤦‍♂️
github statuses are stupid. waiting for github stories

shrynx shrynx

🤦‍♂️
github statuses are stupid. waiting for github stories
View GitHub Profile
@desandro
desandro / halftone-cartesian.pde
Last active October 4, 2022 11:48
Half-ton halftones Processing sketch
// options
String imagePath = "img/desandro-avatar.jpg";
float res = 10; // resolution, dot density
float zoom = 3.0; // proportion to zoom image
boolean isAdditive = true; // true = RGB, false = CMY
float offsetAngle = 1; // affects dot pattern
/*
0 = no patter
0.05 = slight offset
1 = slight offset
@mikehaertl
mikehaertl / gist:3258427
Created August 4, 2012 15:40
Learn you a Haskell - In a nutshell

Learn you a Haskell - In a nutshell

This is a summary of the "Learn You A Haskell" online book under http://learnyouahaskell.com/chapters.


1. Introduction

  • Haskell is a functional programming language.
@OlegIlyenko
OlegIlyenko / Event-stream based GraphQL subscriptions.md
Last active May 28, 2024 17: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.

@btroncone
btroncone / rxjs_operators_by_example.md
Last active June 15, 2024 07:17
RxJS 5 Operators By Example
@CrowdHailer
CrowdHailer / actor.js
Last active March 23, 2021 10:43
Implementing actors in JavaScript.
// Turns out this was not too difficult.
// By using the event loop as a global mail box ordering is even guaranteed for messages between only two actors.
// TODO would like to try and put one actor in a web worker to get some real parallism
// TODO would like to handle errors and have the concept of a deceased actor while a reference to an actor still exists. Probably involves creating an actor system like in Scala. Eurgh.
var actor = {
send: function(message) {
var self = this;
console.log("sending to:", self);
setTimeout(function(){
@stagfoo
stagfoo / pinky.scss
Last active March 5, 2017 09:04
Really small and Simple Sass Grid system
[class*='col-'] {
//Aligns the columns next to each other
width: 100%;
float:left;
min-height: 1px;
}
// an extend only class for clearfixing
%clearfix {
*zoom: 1;
&:before,
@developit
developit / factory-loader.md
Created March 25, 2017 18:24
factory-loader

Factory Loader

This is a tiny webpack loader that invokes a given module with another as an argument.

What's that useful for? Dependency Injection! Maybe this is how we can solve the VDOM fragmentation issue.

Example

Here's a library-agnostic VDOM component. Notice that it doesn't import react/preact/inferno/whatever - instead, it takes the VDOM library as an argument.

@lexi-lambda
lexi-lambda / Main.hs
Last active July 5, 2023 18:01
Minimal Haskell implementation of Complete and Easy Bidirectional Typechecking for Higher-Rank Polymorphism
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Language.HigherRank.Main
( Expr(..)
, EVar(..)
, Type(..)
, TVar(..)
, TEVar(..)
, runInfer
) where
@evancz
evancz / data-interchange.md
Last active April 29, 2024 16:53
Why do I have to write JSON decoders in Elm?

A vision for data interchange in Elm

How do you send information between clients and servers? What format should that information be in? What happens when the server changes the format, but the client has not been updated yet? What happens when the server changes the format, but the database cannot be updated?

These are difficult questions. It is not just about picking a format, but rather picking a format that can evolve as your application evolves.

Literature Review

By now there are many approaches to communicating between client and server. These approaches tend to be known within specific companies and language communities, but the techniques do not cross borders. I will outline JSON, ProtoBuf, and GraphQL here so we can learn from them all.

@sebmarkbage
sebmarkbage / Infrastructure.js
Last active June 2, 2024 08:51
SynchronousAsync.js
let cache = new Map();
let pending = new Map();
function fetchTextSync(url) {
if (cache.has(url)) {
return cache.get(url);
}
if (pending.has(url)) {
throw pending.get(url);
}