Skip to content

Instantly share code, notes, and snippets.

@adamkl
adamkl / resolverChaining.ts
Last active October 19, 2021 12:46
An example of how to chain together local and remote GraphQL resolvers.
import {
fetchRemoteSchema,
authLink
} from "@private/graphql-proxy";
import { startGraphQLService } from "@private/graphql-scripts";
import { graphql, printSchema, print, parse } from "graphql";
import {
mergeSchemas,
makeRemoteExecutableSchema,
makeExecutableSchema
@mrbar42
mrbar42 / README.md
Last active April 20, 2024 02:57
bash scripts to create VOD HLS stream with ffmpeg almighty (tested on Linux and OS X)

running:

bash create-vod-hls.sh beach.mkv

will produce:

    beach/
      |- playlist.m3u8
 |- 360p.m3u8
@geoffreydhuyvetters
geoffreydhuyvetters / react_fiber.md
Last active January 13, 2023 06:49
What is React Fiber? And how can I try it out today?
@bevacqua
bevacqua / NonBlockingRenderLoop.js
Last active July 22, 2021 17:24
Defer secondary portions of the DOM using `requestAnimationFrame`
import { Component, PropTypes } from 'react'
import { noop } from 'lodash'
import raf from 'raf'
const cache = new Map()
export function createNonBlockingRenderLoop({ key, concurrencyLevel = 1 }) {
if (cache.has(key)) {
return cache.get(key)
}
import React from 'react'
import { render } from 'react-dom'
import { Match, Link, BrowserRouter as Router } from 'react-router'
import matchSorter from 'match-sorter'
import './styles.css'
const API = 'http://localhost:3000'
const token = localStorage.booksToken || Math.random().toString()
localStorage.booksToken = token
@developit
developit / _delegated-component.md
Last active October 20, 2016 21:39
DelegatedComponent

Experiment: Backbone-style events in Preact

What if we wanted to use backbone-style event delegation within the component paradigm afforded by react/preact/etc? Would that be useful?

Example

Basic usage:

@ilfroloff
ilfroloff / ClassA.js
Last active March 4, 2024 09:01
JavaScript Singleton using class
'use strict';
import Singleton from 'Singleton';
class ClassA extends Singleton {
constructor() {
super();
}
singletonMethod1() {
// ...
// from the brilliant mind of sb
var _catch = Promise.prototype.catch;
Promise.prototype.catch = function () {
return _catch.call(this, function (err) { setTimeout(function () { throw(err); }, 0); });
}
@Jpoliachik
Jpoliachik / index.ios.js
Last active August 17, 2021 10:27
ReactNative LayoutAnimation Example
'use strict';
import React, {
AppRegistry,
Component,
StyleSheet,
Text,
View,
TouchableOpacity,
LayoutAnimation,
} from 'react-native';
@staltz
staltz / tiny-cycle-1.js
Created December 10, 2015 18:53
Tiny Cycle.js 1
function main() {
return {
DOM: Rx.Observable.timer(0, 1000)
.map(i => `Seconds elapsed ${i}`)
};
}
const drivers = {
DOM: function DOMDriver(sink) {
sink.subscribe(text => {