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 fs = require('fs'), | |
prependFile = require('prepend-file'), | |
moment = require('moment'), | |
version = getVersion(), | |
template = | |
`some-package-name (${version}) stable; urgency=low | |
* ${version} | |
-- Dmitry Dushkin <[email protected]> ${getTime()} |
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
// @flow | |
type Props = { | |
el: EventTargetWithPointerEvents, | |
onDrag: Function, | |
onDragEnd: Function, | |
onClick: Function | |
}; | |
export type GestureEvent = { | |
deltaX: number |
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
/** | |
* | |
* @param {String} path - express-style path | |
* @param {Object} params | |
* @returns {String} | |
* | |
* @example pathToUrl('/users/:userId', { userId: 10 }) -> '/users/10' | |
*/ | |
export const pathToUrl = (path, params) => { | |
return path.replace(/:(\w+)/g, (match, str) => { |
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 Modal from 'react-modal'; | |
import { addQuery, removeQuery } from './utils-router.js'; | |
const OPEN_MODAL_QUERY = 'openModal'; | |
function SomeComponent({ location }) { | |
return <div> | |
<button onClick={ () => addQuery({ OPEN_MODAL_QUERY : 1 })}>Open modal</button> | |
<Modal | |
isOpen={ location.query[OPEN_MODAL_QUERY] } |
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 { browserHistory } from 'react-router'; | |
/** | |
* @param {Object} query | |
*/ | |
export const addQuery = (query) => { | |
const location = Object.assign({}, browserHistory.getCurrentLocation()); | |
Object.assign(location.query, query); | |
browserHistory.push(location); | |
}; |
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 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({ |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset='utf-8'> | |
<title>YAF</title> | |
<style type='text/css'> | |
body { | |
padding: 24px; | |
font-size: 18px; | |
} |
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
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() { |
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, 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 { |
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
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! | |
*/ |