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
| #!/usr/bin/env ruby | |
| require 'net/http' | |
| require 'json' | |
| require 'uri' | |
| require 'digest' | |
| require 'fileutils' | |
| # Константы | |
| OPENAI_API_KEY = ENV['OPENAI_API_KEY'] | |
| OPENAI_API_URL = "https://api.openai.com/v1/chat/completions" |
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
| require 'awesome_print' | |
| require 'active_support/all' | |
| class Modules | |
| include Singleton | |
| attr_reader :src_dir | |
| def initialize | |
| @src_dir = find_src_dir |
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
| #!/usr/bin/env ruby | |
| require 'active_support/all' | |
| class Session | |
| FIELDS = [:path, :created, :pid, :owner, :device, :config_name, :session_name, :status] | |
| @@sessions = [] | |
| attr_accessor(*FIELDS) | |
| attr_accessor :id |
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
| this.strategy = new FacebookStrategy({ | |
| clientID: FACEBOOK_APP_ID, | |
| clientSecret: FACEBOOK_APP_SECRET, | |
| passReqToCallback: true, | |
| profileFields: ['id', 'emails', 'name'], | |
| callbackURL: '/oauth2/redirect/facebook', | |
| store: true | |
| }, (req, accessToken, refreshToken, profile, cb) => { | |
| d(`\n\noauth state in verify = `, req.oauthState) | |
| return cb(null, {}) |
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, { | |
| createContext, | |
| Reducer, | |
| RefObject, | |
| useCallback, | |
| useContext, | |
| useMemo, | |
| useReducer, | |
| useRef, | |
| } from 'react' |
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 path = require('path') | |
| const fs = require('fs') | |
| const debug = console.log | |
| const buildDirMap = (dirPath) => { | |
| const map = {} | |
| const items = fs.readdirSync(dirPath) | |
| for (const name of items) { | |
| map[name] = fs.statSync(path.join(dirPath, name), { throwIfNoEntry: false }) |
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
| > label { | |
| margin-top: 10px; | |
| padding-left: 10px; | |
| display: grid; | |
| grid-template-columns: 12px auto; | |
| gap: 12px; | |
| input[type='checkbox'] { | |
| appearance: none; | |
| margin: 0; |
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, { Context, Reducer, useContext, useEffect, useMemo, useReducer } from 'react' | |
| type Status = 'init' | 'processing' | 'error' | 'success' | |
| interface IItemState<Item> { | |
| id: number | |
| stage: number | |
| item: Item | |
| status: Status | |
| } |
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, { Context, Reducer, useContext, useMemo, useReducer } from 'react' | |
| type ItemState<Item> = | |
| | { status: 'loading'; id: number; item?: Item } | |
| | { status: 'error'; id: number; error: string; item?: Item } | |
| | { status: 'success'; id: number; item: Item } | |
| interface IActions { | |
| fetchItem: (id: number) => Promise<void> | |
| reset: () => void |
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, { Context, Reducer, useContext, useMemo, useReducer } from 'react' | |
| type Action<Value> = | |
| | { type: 'request' } | |
| | { type: 'success'; value: Value } | |
| | { type: 'failure'; error: string } | |
| | { type: 'reset' } | |
| type Dispatch<Value> = (action: Action<Value>) => void |
NewerOlder