This file contains hidden or 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 slice = (array, from, to) => { | |
let realFrom = from < 0 ? array.length + from : from | |
let realTo = to > array.length ? to - array.length : to | |
return (realFrom <= realTo | |
? array.slice(realFrom, realTo) | |
: array.slice(realFrom, array.length).concat(array.slice(0, realTo)) | |
) | |
} |
This file contains hidden or 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 capitalize = string => | |
`${string.charAt(0).toUpperCase()}${string.slice(1)}` | |
const withFullState = stateSpec => | |
compose( | |
...Object | |
.keys(stateSpec) | |
.map(stateKey => | |
withState( | |
stateKey, |
This file contains hidden or 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 './assets/emoji-picker.css' | |
import React, { Component } from 'react' | |
import { chatsApi, infoApi } from './api' | |
import AppAside from './AppAside' | |
import { | |
preloadDataSuccess as chatsPreloadDataSuccess |
This file contains hidden or 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 axiosCreator from '../axios' | |
import { getToken } from '../../cookies/server' | |
import httpStatus from 'http-status-codes' | |
import { preload as preloadData } from 'redux-router-preload/lib/server' | |
import { removeToken } from '../../cookies/server' | |
const preload = (req, res, next) => { | |
const axios = axiosCreator(getToken(req)) | |
preloadData(req.store, {axios}) |
This file contains hidden or 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
# Add this snippet to the top of your playbook. | |
# It will install python2 if missing (but checks first so no expensive repeated apt updates) | |
# [email protected] | |
- hosts: all | |
gather_facts: False | |
tasks: | |
- name: install python 2 | |
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal) |
This file contains hidden or 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
// copy and execute in devtools console | |
// to stop execute stop() | |
// to launch again execute go() | |
let handler; | |
const getRandomSign = () => Math.random() > 0.5 ? 1 : -1; | |
const roundRandomNumber = (max, min = 0) => min + Math.floor(Math.random() * max); | |
const fuckShitUp = |
This file contains hidden or 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 { | |
createCanvas, | |
registerFont, | |
loadImage | |
} = require('canvas') | |
// подгружаем шрифт | |
registerFont('./static/fonts/d-m.woff', { family: 'D-M' }) |
This file contains hidden or 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
updatePointer = (pointer, { x, index, shift }) => { | |
const { pointerWidth, pointerHeight } = this.props | |
const { origin, freq, amplitude } = this.state | |
const baseY = Math.sin(freq * x + shift) * amplitude + origin.y | |
pointer.setAttribute('points', ` | |
${x}, ${baseY} | |
${x + pointerWidth}, ${Math.sin(freq * x + shift) * amplitude + origin.y - pointerHeight / 2} | |
${x}, ${Math.sin(freq * x + shift) * amplitude + origin.y - pointerHeight} | |
`) |
This file contains hidden or 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 (Blotter) { | |
Blotter.LiquidDistortMaterial = function () { | |
Blotter.Material.apply(this, arguments) | |
} | |
Blotter.LiquidDistortMaterial.prototype = Object.create( | |
Blotter.Material.prototype | |
) | |
Blotter._extendWithGettersSetters( |
This file contains hidden or 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 screenPosition = point.position.clone(); | |
screenPosition.project(camera); | |
const translateX = screenPosition.x * canvas.width * 0.5; | |
const translateY = -screenPosition.y * canvas.height * 0.5; | |
element.style.transform = `translate(${translateX}px, ${translateY}px)`; |
OlderNewer