Skip to content

Instantly share code, notes, and snippets.

@skokenes
skokenes / sample-tree.csv
Created February 5, 2018 20:48
Sample Tree
Category Product Day Sales
Fruit Apples Mon 111
Fruit Apples Tue 98
Fruit Apples Wed 120
Fruit Apples Thu 85
Fruit Apples Fri 78
Fruit Apples Sat 107
Fruit Oranges Mon 75
Fruit Oranges Tue 95
Fruit Oranges Wed 100
@skokenes
skokenes / federal_min_wage.csv
Created February 5, 2018 15:26
D3 For Designers Data Sets
year month day date Federal Minimum Wage source
1974 5 1 01may1974 2 Federal - DOL - Historical Minimum Wage Changes - 01.14.2016
1975 1 1 01jan1975 2.1 Federal - DOL - Historical Minimum Wage Changes - 01.14.2017
1976 1 1 01jan1976 2.3 Federal - DOL - Historical Minimum Wage Changes - 01.14.2018
1978 1 1 01jan1978 2.65 Federal - DOL - Historical Minimum Wage Changes - 01.14.2019
1979 1 1 01jan1979 2.9 Federal - DOL - Historical Minimum Wage Changes - 01.14.2020
1980 1 1 01jan1980 3.1 Federal - DOL - Historical Minimum Wage Changes - 01.14.2021
1981 1 1 01jan1981 3.35 Federal - DOL - Historical Minimum Wage Changes - 01.14.2022
1990 4 1 01apr1990 3.8 Federal - DOL - Historical Minimum Wage Changes - 01.14.2023
1991 4 1 01apr1991 4.25 Federal - DOL - Historical Minimum Wage Changes - 01.14.2024
@skokenes
skokenes / example-usage.js
Last active December 15, 2017 16:18
RxJS Custom Operator: Partition by Keys
import { interval } from "rxjs/Observable/interval";
import { map, take } from "rxjs/operators";
import partitionByKeys from "./partitionByKeys.js"
// Create a stream of objects
var objects$ = interval(1000).pipe(
map(m => (
{
id: m,
rand: Math.random()
@skokenes
skokenes / README.md
Created October 6, 2017 21:52
RxJS 5.5.0-beta.5 issue with mergeMap vs. map + mergeAll

Issue: mergeMap() potentially not working properly in RxJS 5.5.0-beta.5

I have an open source library built on top of RxJS. This library is responsible for handling API requests and responses between a client and a server. The communication between the client and server is via a websocket. The library allows you to make an API call to the server and returns an Observable for the response to the API call.

The library is built using RxJS 5.5.0-beta.5's lettable operators. The library distribution includes a bundled build that can be used in the browser. When the browser bundle is being used, it is likely that someone would be using the RxJS bundled library as well.

In the example posted here, I've mocked up an extremely simple version of the library. The library has an "ask" function that will make a fake API call and return an Observable for the response. In the index.html file, I am simulating using the library with an RxJS bundle. Specifically, I am trying to create a stream of API call responses using

@skokenes
skokenes / error-description
Last active September 21, 2017 11:32
QS Sept-2017 Tech Preview Pivot Table error
When putting both the cubes on a single generic object def, I am unable to use `qGetHyperCubePivotData` to get data from either cube.
I get -128 Internal error back. If I comment out either one and just have the single cube defined,
I can fetch pages without issue.
@skokenes
skokenes / index.html
Last active May 4, 2018 13:12
A simple progress bar with RxJS and D3
<html>
<head>
<script src = "https://cdnjs.cloudflare.com/ajax/libs/d3/4.9.1/d3.min.js"></script>
<script src = "https://cdnjs.cloudflare.com/ajax/libs/rxjs/5.4.1/Rx.min.js"></script>
</head>
<body>
<div id="time"></div>
<input type="range"></input>
<button id = "play">Play</button>
<button id = "pause">Pause</button>
@skokenes
skokenes / .block
Last active April 30, 2017 15:56
vega-lite test2
license: mit
@skokenes
skokenes / index.html
Last active April 29, 2017 13:59
vega-lite testing
<html>
<head>
<!-- Import Vega 3 & Vega-Lite 2 js (does not have to be from cdn) -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/vega/3.0.0-beta.25/vega.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vega-lite/2.0.0-alpha.7/vega-lite.js"></script>
<!-- Import vega-embed -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/vega-embed/3.0.0-beta.7/vega-embed.js"></script>
</head>
<body>
@skokenes
skokenes / addAltStatesOnOpen.js
Created January 13, 2017 13:51
RxQ - Adding alternate states on app open
// Define a server
var config = {/*<server config here>*/}
var appId = "<app id here>";
var states = ["Alt-State-1","Alt-State-2"];
// Observable for holding the app on an initial open
var initApp$ = RxQ.connectEngine(config, "warm")
.qOpenDoc(appId);
@skokenes
skokenes / my-ext.js
Created January 5, 2017 21:42
Debouncing Qlik Sense extension paint calls
define(["underscore"],function(_) {
return {
// other extension properties...,
controller: function($scope) {
var myPaintFunction = function($element, layout) {
// render your extension somehow...
};
$scope.debouncedPaint = _.debounce(myPaintFunction, 250);
},
paint: function($element, layout) {