Skip to content

Instantly share code, notes, and snippets.

View bogdanbiv's full-sized avatar
💭
I may be slow to respond.

Bogdan Bivolaru bogdanbiv

💭
I may be slow to respond.
View GitHub Profile

Iterables, AsyncIterables, Observables, Oh My!

I know there is a lot of confusion around Observables, Iterables, AsyncIterables and AsyncObservables. Let's try to break this down and the reasons for each.

Pull versus Push Collections

When it comes to collections, you have two ways of thinking about collections, push versus pull. With pull, the consumer is in control of when you get the items, but with push, you get the values when the producer is ready.

Pull Based Collections

@bogdanbiv
bogdanbiv / Readme.md
Last active February 25, 2018 13:28
Another description for this gist

My dynamic gist.

@bogdanbiv
bogdanbiv / bitSmearing.js
Created December 24, 2017 09:06
CodeGolf
// https://codegolf.stackexchange.com/questions/151537/alternating-bit-smearing
// CodeGolf - alternating bit smearing over trailing 00 for numbers in base 2
smear = function (num) {
const old = num;
let replaces = 0, remind = num%4===0, supl = 0;
while (remind) {
console.log(remind);
remind?replaces++:0;
@bogdanbiv
bogdanbiv / .gitignore
Last active August 29, 2015 14:14
Reloading Connect/Express server code using grunt-contrib-watch and reload option
*~
node_modules
// See http://javascriptweblog.wordpress.com/2011/08/08/fixing-the-javascript-typeof-operator/
(function(global) {
// Maintain a map of already-encountered types for super-fast lookups. This
// serves the dual purpose of being an object from which to use the function
// Object.prototype.toString for retrieving an object's [[Class]].
var types = {};
// Return a useful value based on a passed object's [[Class]] (when possible).
Object.toType = function(obj) {
@bogdanbiv
bogdanbiv / Circular Safe Object Inspector
Created October 12, 2014 18:28
Serialize object keys and values except values that are arrays or other objects. This is to be used in case JSON.stringify fails due to cyclic...
function mystringify(input) {
var key, type, retVal = "";
for(key in input) {
if (input.hasOwnProperty(key)) {
type = typeof(input[key]);
if (type === 'array' || type === 'object') {
retVal += key + ": " + type + ", ";
} else {
retVal += key + ": " + input[key] + ", ";
}
@bogdanbiv
bogdanbiv / jitsu_deploy_shell
Last active December 15, 2015 05:39
Application cannot start because in the start.sh script some symbols are not recognised: dot = error,
info: Welcome to Nodejitsu bogdanb
info: jitsu v0.12.7, node v0.8.14
info: It worked if it ends with Nodejitsu ok
info: Executing command deploy
info: Skipping require-analyzer because noanalyze option is set
info: Skipping require-analyzer because noanalyze option is set
warn: Local package version appears to be old
warn: The package.json version will be incremented automatically
warn: About to write /home/bogdanbiv/WebstormProjects/life-trackr/package.json
data:
@bogdanbiv
bogdanbiv / IsolateRootCause
Last active December 15, 2015 00:19
Question: Check line 711 will have a error about not finding nasm (Netwide Assembler) in file NPM_install_console_log. Even better check line 455 in file New_NPM_install_console_log and see that it contains the same nasm error, clearly unrelated to tap. What do webapps have to do with "nasm (Netwide Assembler)"? Steps to reproduce: * Install Yeo…
bogdanbiv@bogdanbiv-P35-DS3:~/WebstormProjects$ mkdir npmtest
bogdanbiv@bogdanbiv-P35-DS3:~/WebstormProjects$ cd npmtest/
bogdanbiv@bogdanbiv-P35-DS3:~/WebstormProjects/npmtest$ npm install jpegtran-bin
npm http GET https://registry.npmjs.org/jpegtran-bin
npm http 304 https://registry.npmjs.org/jpegtran-bin
npm http GET https://registry.npmjs.org/colors
npm http GET https://registry.npmjs.org/which
npm http 304 https://registry.npmjs.org/colors
npm http 304 https://registry.npmjs.org/which