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 PasswordView = Backbone.View.extend({ | |
| // Выносим требования в константу для переиспользования | |
| requirements: [ | |
| { id: 'len8', label: '8+ characters', test: (pwd: string) => pwd.length >= 8 }, | |
| { id: 'len12', label: '12+ characters', test: (pwd: string) => pwd.length >= 12 }, | |
| { id: 'lower', label: 'Lowercase letter', test: (pwd: string) => /[a-z]/.test(pwd) }, | |
| { id: 'upper', label: 'Uppercase letter', test: (pwd: string) => /[A-Z]/.test(pwd) }, | |
| { id: 'digit', label: 'Number', test: (pwd: string) => /\d/.test(pwd) }, | |
| { id: 'special', label: 'Special character', test: (pwd: string) => /[^a-zA-Z0-9]/.test(pwd) } | |
| ], |
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
| export function loggerDecoratorUnary(func: GrpcWebImpl['unary']) { | |
| return async function (this: GrpcWebImpl, ...params: Parameters<GrpcWebImpl['unary']>) { | |
| const id = uuidv7(); | |
| try { | |
| params[2] = createMetadata(); | |
| window.postMessage( | |
| { | |
| source: '__gRPC_devtools_content_scripts_main__', |
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 { createStore, createEvent, is, fork, allSettled } from 'effector'; | |
| import { produce } from 'immer'; | |
| function createCollection(store, events) { | |
| const collection = createStore({}); | |
| const setStoreValue = createEvent(); | |
| store.on(setStoreValue, (state, value) => value); | |
| let length = 0; | |
| let keys = []; |
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
| export class AsyncTaskSeq { | |
| last = Promise.resolve(); | |
| add(task: () => Promise<void>) { | |
| const sync = this.last; | |
| this.last = new Promise(async (resolve, reject) => { | |
| try { | |
| await sync; | |
| await task(); | |
| resolve(); |
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 { attach, createEffect } from 'effector'; | |
| import { HTTP_METHOD, RequestFxParams, ResponseError, User } from './types'; | |
| import { $session } from '../models/session'; | |
| export const GET = 'GET'; | |
| export const POST = 'POST'; | |
| export const PUT = 'PUT'; | |
| export const DELETE = 'DELETE'; | |
| const URL = 'https://api.realworld.io/api'; |
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
| _try = (cb) => { | |
| let error; | |
| try { | |
| cb(); | |
| } catch(e) { | |
| error = e; | |
| } | |
| const result = { | |
| catch: (err, handler) => { |
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 React from 'react'; | |
| import { useEvent, useStore } from 'effector-react'; | |
| import { $counter, dec, inc, reset } from './counter'; | |
| export const App = () => { | |
| const counter = useStore($counter); | |
| const api = useEvent({ inc, dec, reset }); | |
| return ( | |
| <div> |
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
| async function loadModule(url, removeExports) { | |
| delete window.exports | |
| const text = await (await fetch(url)).text() | |
| window.eval(text) | |
| return text | |
| } | |
| await loadModule('https://threejs.org/build/three.js') | |
| await loadModule('https://cdnjs.cloudflare.com/ajax/libs/ramda/0.25.0/ramda.min.js') |
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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>CandleStick Chart</title> | |
| <style> | |
| #chart { | |
| border: 1px solid red; |
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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>CandleStick Chart</title> | |
| <style> | |
| #chart { | |
| border: 1px solid red; |
NewerOlder