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 { tag, encode, decode } from './paddedIntermidiate'; | |
| import getObfuscation from './obfuscation'; | |
| /** | |
| * Base class to work with telegram websocket | |
| */ | |
| export default class Connection extends EventTarget { | |
| constructor(url) { | |
| super(); | |
| this.url = url; |
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
| /** | |
| * Encrypts by AES-CTR | |
| * @param {ArrayBuffer} buffer | |
| * @param {ArrayBuffer} key | |
| * @param {ArrayBuffer} iv | |
| */ | |
| export function encryptCtr(buffer, key, iv) { | |
| const bufferView = new Uint8Array(buffer); | |
| const keyView = new Uint8Array(key); | |
| const ivView = new Uint8Array(iv); |
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() { | |
| var current = createMyObj(); | |
| function createMyObj() { | |
| var newFigure = new myobj('red'); | |
| return newFigure; | |
| } | |
| function start(){ |
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 cathcEventMiddleware = store => next => action => { | |
| const eventType = 'eventType'; | |
| const eventListener = event => { | |
| dispatch({ | |
| type: 'BROWSER_EVENT_FIRED', | |
| eventType: eventType, | |
| event | |
| }); |
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* makeRequest() { | |
| const response = yield call( | |
| fetch, | |
| '/url', | |
| ); | |
| if (response status === 200) { | |
| yield put({ type: 'SUCCESS' }); | |
| } else { | |
| yield put({ type: 'FAILED' }); |
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 step = 3; | |
| const posts = new Array(100) | |
| .fill('p') | |
| .map((item, idx) => `${item}${idx + 1}`) | |
| .map((item, idx) => ((idx + 1) % step) === 0 ? [item, null] : [item]) | |
| .reduce((acc, item) => [...acc, ...item], []); | |
| console.log(posts); |
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 requests | |
| response = requests.get('http://ufa.farfor.ru') | |
| csrftoken = response.cookies['csrftoken'] | |
| while True: | |
| response = requests.post( | |
| 'http://ufa.farfor.ru/api/marketing/slotmachine/', | |
| headers={ | |
| 'host': 'ufa.farfor.ru', |
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 { expect } from 'chai'; | |
| import nock from 'nock'; | |
| import configureStore from 'redux-mock-store'; | |
| import thunk from 'redux-thunk'; | |
| import { login, signUp, alertMessage, loadMe } from './application'; | |
| import constants from '../constants/application'; | |
| const middlewares = [thunk]; | |
| const mockStore = configureStore(middlewares); |
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 constants from '../constants/application'; | |
| export function showDialog(dialogName) { | |
| return { type: constants.SHOW_DIALOG, payload: { dialogName } }; | |
| } | |
| export function hideDialog() { | |
| return { type: constants.HIDE_DIALOG }; | |
| } |
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
| class SomeComponent extends React.Component { | |
| static propTypes = { | |
| action: PropTypes.func, | |
| } | |
| handleSubmit() { | |
| const { action } = this.props; | |
| action(); | |
| } | |
NewerOlder