Skip to content

Instantly share code, notes, and snippets.

View DimitryDushkin's full-sized avatar
😀
RxJS!

Dimitry DimitryDushkin

😀
RxJS!
View GitHub Profile
$('body').append('<div id="log" style="position: fixed; color: red; left:0;top:0;right:0; z-index: 100000"></div>');
window.consoleLog = function(text) {
$('#log').append('<p>' + text + '</p>');
};
{
"metadata": {
"name": "agadganov"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
{
"metadata": {
"name": "data analysis"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
{
"metadata": {
"name": "data analysis"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@DimitryDushkin
DimitryDushkin / resposive-typography-basics.styl
Last active June 7, 2016 09:07
Example of basic mixins for Stylus to make typography on site responsive
$default-font-size = 16px
mobile()
@media (max-width: 800px)
{block}
small-mobile()
@media (max-width: 450px)
{block}
@DimitryDushkin
DimitryDushkin / get_random_array_elements_limit.js
Created September 22, 2016 12:54
Get random array elements from array with limit
function getRandomArrayElements(arr, count) {
var sliceStart = getRandomInt(0, arr.length - count),
randomSlice = arr.slice(sliceStart, sliceStart + count);
return shuffleArray(randomSlice);
}
/**
* Returns a random integer between min (inclusive) and max (inclusive)
* Using Math.round() will give you a non-uniform distribution!
*/
import React, { Component, PropTypes} from 'react';
import ReactInfinite from 'react-infinite';
// @copy-paste https://github.com/Radivarig/react-infinite-any-height
// refactored and optimized
/**
* How it works: long story short it adds elements' height on rendering in react-infinite
*/
class InfiniteAnyHeight extends Component {
@DimitryDushkin
DimitryDushkin / let.js
Created January 18, 2017 08:16
Power or let (JS)
function letExample() {
var a = [1,2,3,4,5],
seq = Promise.resolve();
for (let b of a) {
seq = seq.then(() => new Promise(resolve => { setTimeout(()=> {console.log(b); resolve();}, 100) }));
}
}
function varExample() {
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title>YAF</title>
<style type='text/css'>
body {
padding: 24px;
font-size: 18px;
}
@DimitryDushkin
DimitryDushkin / ReactTablePagination.jsx
Created January 30, 2017 11:33
ReactTablePagination
import React from 'react';
import cn from 'classnames';
import Select from 'react-islands/components/Select';
import Item from 'react-islands/components/Item';
import Input from 'react-islands/components/TextInput';
import './ReactTablePagination.styl';
export default React.createClass({