This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {Component} from 'react'; | |
import logo from './logo.svg'; | |
import './App.css'; | |
import firebase from 'firebase'; | |
class App extends Component { | |
constructor(props) { | |
super(props); | |
var config = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface OnInit { | |
ngOnInit(): void; | |
} | |
class stackoverflow implements OnInit { | |
async ngOnInit() { | |
return await new Promise(res => { | |
setTimeout(() => { | |
alert('ngOnInit'); | |
res(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Observable = Rx.Observable; | |
let input1$ = Observable.fromEvent(document.querySelector('#b1'), 'click').mapTo('1'); | |
let input2$ = Observable.fromEvent(document.querySelector('#b2'), 'click').mapTo('2'); | |
let input3$ = Observable.fromEvent(document.querySelector('#b3'), 'click').mapTo('3'); | |
let input4$ = Observable.fromEvent(document.querySelector('#b4'), 'click').mapTo('4'); | |
let inputs$ = Observable.merge(input1$ ,input2$ ,input3$ ,input4$); | |
function getPromise(x) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let x= "Anna Vadim Julia"; | |
let res = _.compose(_.join(''),_.map(x=>x.charAt(0)),_.split(' '))(x); | |
console.log(res); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div ui-view autoscroll="true"> | |
<span | |
style="display:flex;justify-content:center;align-items:center;height:100vh;font-size:30px;color:#002887;"> | |
App Loading... | |
</span> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let col = [ | |
{name:'Julia', count:4}, | |
{name:'Vadim', count:6}, | |
{name:'Anna', count:2}]; | |
let res = _.compose(_.get('name'), _.first, _.sortBy('count'))(col); | |
console.log(res); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//var madd3 = R.lift(R.curry((a, b, c) => a + b + c)); | |
//madd3([1,2,3], [1,2,3], [1]); //=> [3, 4, 5, 4, 5, 6, 5, 6, 7] | |
// the same written with flatMap and map | |
let res = _.flatMap([1,2,3], x => _.flatMap([1,2,3], y => _.map([1], z => x+y+z))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let x = ['cat,dog', 'man,woman']; | |
let res = _.compose(_.flatMap(_.identity), _.split(','))(x); | |
console.log(res); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let words = "aaa ggg aaa ggg aaa ffff aaaAAAAAAA ggg aaa ggg aaa fff rrr aaa"; | |
let y = _.compose( | |
_.reduce((x,y)=>x.length>y.length?x:y,""), | |
_.split(' ') | |
)(words); | |
let y = _.compose( | |
_.last, | |
_.sortBy(_.size), | |
_.split(' ') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let words = "aaa ggg aaa ggg aaa ffff aaa ggg aaa ggg aaa fff rrrr aaa"; | |
let y = _.compose( | |
_.get('word'), | |
_.head, | |
_.orderBy('count', 'desc'), | |
_.map(p=>({word:p[0], count:p[1]})), | |
_.toPairs, | |
_.reduce((acc, next) => { | |
acc[next] = (acc[next] && acc[next]+1) || 1; | |
return acc; |
NewerOlder