Skip to content

Instantly share code, notes, and snippets.

Avatar
💻
Working remotely @toptal

Ilya N. Zykin the-teacher

💻
Working remotely @toptal
View GitHub Profile
View webpack-storybook-config.js
module.exports = {
stories: ['../stories/**/*.stories.js'],
addons: ['@storybook/addon-actions', '@storybook/addon-links'],
webpackFinal: async config => {
/*
* Drop babel-loader for `.js|.md` pattern.
* (It's the first rule in the rules list.)
*
* It turned out that storybook had a conflict in the babel-loader configuration
View code1.rb
class PostsController < ApplicationController
def index
# ...
end
def show
# ...
end
def create
View tanos.rb
# сохранить все текущие данные где-то
console_run `pg_dump opencook.ru > ./DUMP/orifinal_dump.opencook.ru`
console_run `cp -R ./public/uploads ./DUMP/original_files_dump`
# Хреначим прямо на живой базе
# Не создавая соединений
# Не создавая промежуточных моделей
User.update_all(password: 'password')
Post.destroy_if(ЧЕТНЫЕ)
View gist:7e0a518ec6b68ff2a44f66617b722142
$ rake ts:configure


/Users/the-teacher/.rvm/gems/ruby-2.3.3@open-cook.ru/gems/compass-core-1.0.1/lib/compass/core/caniuse.rb:72: warning: circular argument reference - browsers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TheComments
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
WARNING!
StateMachine patch for Rails4 will be applied
View routing-2.js
import React from 'react'
import 'jest-dom/extend-expect'
import { render, cleanup } from 'react-testing-library'
import TestingRouter from './TestingRouter'
import Task from './Task'
afterEach(cleanup)
View routing-1.js
import React from 'react'
import { Router, Route } from 'react-router-dom'
import { createMemoryHistory } from 'history'
const history = createMemoryHistory()
const TestingRouter = ({ ComponentWithRedirection, RedirectUrl }) => (
<Router history={history}>
<Route path="/" exact={true} render={() => <ComponentWithRedirection />} />
<Route path={RedirectUrl} render={() => <div>{RedirectUrl}</div>} />
View console.warn.test.js
import React from 'react'
import 'jest-dom/extend-expect'
import { render, cleanup } from 'react-testing-library'
import SystemError from './SystemError'
afterEach(cleanup)
describe('SystemError', () => {
View test.js
const SystemError = ({ error }) => {
console.warn(error.name)
console.warn(error.message)
return (
<div>
<h3>Sorry!</h3>
<p>Something went wrong. Please try again later.</p>
</div>
)
View apollo-2.jsx
class TaskIsNotDone extends React.Component {
submitButtonHandler = makeTaskDoneMutation => {
return () => {
makeTaskDoneMutation({ variables: { taskId: this.props.taskId } })
}
}
onConpleted = data => {
this.props.taskIsDoneHandler()
}
View apollo-1.jsx
class Task extends React.Component {
constructor(props) {
super(props)
this.state = {
taskIsDone: false
}
}
onCompletedHandler (data) {
You can’t perform that action at this time.