Skip to content

Instantly share code, notes, and snippets.

@jhusain
jhusain / index.js
Created August 8, 2014 21:33
requirebin sketch
// example using the raf module from npm. try changing some values!
var Rx = require('rx');
window.Rx = Rx;
!function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),(f.falkor||(f.falkor={})).PathEvaluator=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
var Rx = _dereq_("../src/rx.ultralite");
var Observable = Rx.Observable,
Disposable = Rx.Disposable,
sentinelSize = 50,
isArray = Ar
var print = console.log.bind(console);
// partial implementation of Array.from
Array.from = function(iterable) {
var results = [];
for(var x of iterable) {
results.push(x);
}
return results;
};
@karpolan
karpolan / withSuspense.js
Created August 10, 2019 10:46
withSuspense() HOC for React.lazy() + React.Suspense
import React from 'react';
import { CircularProgress, LinearProgress } from '@material-ui/core/';
/**
* Wraps the React Component with React.Suspense and FallbackComponent while loading.
* @param {React.Component} WrappedComponent - lazy loading component to wrap.
* @param {React.Component} FallbackComponent - component to show while the WrappedComponent is loading.
*/
export const withSuspense = (WrappedComponent, FallbackComponent = null) => {
return class extends React.Component {
@Klerith
Klerith / Instalaciones-React.md
Last active May 6, 2024 03:28
Instalaciones recomendadas para mi curso de React de cero a experto
// my problem: (with a bit of handwaving here — imagine that each step is
// _actually_ async)
function doAThing() {
return new Promise(resolve => { // A
setTimeout(resolve, 100, Math.random())
}).then(randomNum => { // B (derived from A's result)
return randomNum * Math.random()
}).then(superRandomNumber => { // C
return superRandomNumber * originalRandomNumber
// where "originalRandomNumber" === "randomNum" from A
{
"uri": "https://slick.app",
"schemas": {
"invite": "https://slick.app/schemas/invite",
"community": "https://slick.app/schemas/community",
"details": "https://slick.app/schemas/details",
"channel": "https://slick.app/schemas/channel",
"message": "https://slick.app/schemas/message",
"reaction": "https://slick.app/schemas/reaction",
"admin": "https://slick.app/schemas/admin",
@mpgn
mpgn / SubtleCrypto.js
Last active May 6, 2024 03:25
SubtleCrypto javascript example
// exemple based on https://github.com/diafygi/webcrypto-examples#rsa-oaep
function importKey() {
return window.crypto.subtle.importKey(
"jwk", //can be "jwk" or "raw"
{ //this is an example jwk key, "raw" would be an ArrayBuffer
kty: "oct",
k: "Y0zt37HgOx-BY7SQjYVmrqhPkO44Ii2Jcb9yydUDPfE",
alg: "A256GCM",
ext: true,
@Bagniz
Bagniz / Web Development Resources.md
Last active May 6, 2024 03:25
This is a GitHub gist containing some useful links for web development resources a web developer may need.
// Here is a proposal for minimalist JavaScript classes, humbly offered.
// There are (at least) two different directions in which classes can be steered.
// If we go for a wholly new semantics and implementation, then fancier classical
// inheritance can be supported with parallel prototype chains for true inheritance
// of properties at both the class and instance level.
// If however, we keep current JavaScript prototype semantics, and add a form that
// can desugar to ES3, things must necessarily stay simpler. This is the direction
// I'm assuming here.