Skip to content

Instantly share code, notes, and snippets.

@evxn
evxn / verySimpleStorage.js
Last active February 26, 2018 06:37
Simple storage (with test spec) for pure objects (including Function-objects) written in JavaScript
function Factory(){
var _collection = [];
var API = {};
API.contains = function (obj) {
var found = _collection.indexOf(obj) !== -1;
return found;
};
@evxn
evxn / keybase.md
Created October 8, 2014 13:09
keybase.md

Keybase proof

I hereby claim:

  • I am evxn on github.
  • I am evxn (https://keybase.io/evxn) on keybase.
  • I have a public key whose fingerprint is D8C4 47AE 0675 D1A6 FCC1 0F1D C2BC FD19 3347 C14D

To claim this, I am signing this object:

@evxn
evxn / do-on-subscribe.rxjs.operator.ts
Last active March 5, 2021 17:26
rxjs on subscribe hook, callback on subscribe, doOnSubscribe operator, doOnSubscribe pipe, rxjs onSubscribe
import {defer} from 'rxjs/observable/defer';
import {Observable} from 'rxjs/Observable';
/** Example
import {from} from 'rxjs/observable/from';
from([1, 2, 3])
.pipe(doOnSubscribe(() => console.log('subscribed to stream')))
.subscribe(x => console.log(x), null, () => console.log('completed'));
*/
@evxn
evxn / observable-queue.ts
Last active March 26, 2018 07:52
Add Observable-like entities to a queue (Promises, Observables, Subjects, Arrays, generators, Iterables). After each stream is completed (i.e. Promise resolved) it's elements are emitted to the result stream in the order of addition (first in first out). Each subscriber receives result only for items added to queue after the subscription.
import {Subject} from 'rxjs/Subject';
import {BehaviorSubject} from 'rxjs/BehaviorSubject';
import {Observable, ObservableInput} from 'rxjs/Observable';
import {concatMap, switchMap} from 'rxjs/operators';
enum QueueActions {
RESET = 'RESET',
ADD = 'ADD',
}
@evxn
evxn / sample.xml
Last active December 29, 2018 12:53
<?xml version="1.0" encoding="utf-8"?>
<!--open the DOCTYPE declaration -
the open square bracket indicates an internal DTD-->
<!DOCTYPE foo [
<!--define the internal DTD-->
<!ELEMENT foo (#PCDATA)>
<!--close the DOCTYPE declaration-->
]>
<products xmlns="http://www.xmlplease.com/ns1" xmlns:xp="http://www.xmlplease.com/ns2">
<?style – oh, try /style.css?>
This file has been truncated, but you can view the full file.
<?xml version="1.0" encoding="Windows-1252"?>
<LandXML xsi:schemaLocation="http://www.landxml.org/schema/LandXML-1.0
http://www.landxml.org/schema/LandXML-1.0/LandXML-1.0.xsd" version="1.0" date="2007-08-22"
time="15:59:24" xmlns="http://www.landxml.org/schema/LandXML-1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Project name="Divcibare" desc="" />
<Application name="CECS" desc="Export from CECS via LandXML." manufacturer="CAD Solutions."
version="1.0" manufacturerURL="http://www.drrdesign.net" />
<Units>
<?xml version="1.0" encoding="utf-8"?>
<first>
<second>
<text>Text1</text>
<link/>
</second>
<second>
<text>Text2</text>
<link>https://livereach.com</link>
</second>