Skip to content

Instantly share code, notes, and snippets.

View js2me's full-sized avatar
๐Ÿ’ป
Coding without vibe

Sergey S. Volkov js2me

๐Ÿ’ป
Coding without vibe
View GitHub Profile
// store.js
import { StonexStore } from 'stonex'
import modules from './modules'
import Logger from './modifiers/Logger'
import AppStateWorker from './common/AppStateWorker'
const storeConfiguration = {
modifiers: [ // middlewares
// ./modules/index.js
import UsersModule from './UsersModule'
import AuthModule from './AuthModule'
import ModalsModule from './ModalsModule'
const modules = {
users: UsersModule,
auth: AuthModule,
modals: ModalsModule
}
import { StonexModule } from 'stonex'
class UsersModule extends StonexModule {
state = []
addUser = user => this.setState([...this.state, user])
removeAllUsers = () => this.resetState()
}
export default UsersModule
// ./modules/index.js
// don't worry about context. It links when module attaching to the store!
// Also all methods (like 'this.setState' ) from StonexModule class automatic will been inherited
const pureModule = {
state: {},
addItem(item){
this.setState({...this.state, [item.name]: item })
}
}
class Login extends React.Component {
changeForm = ({ target }) => {
this.setState({ [target.name]: target.value })
}
render() {
const { firstName, lastName } = this.state
return (
// login component
import { connect } from 'react-stonex
const Login = ({ firstName, lastName, changeAuthData }) => (
<div>
<input value={firstName} onChange={e => this.changeAuthData('firstName', e.target.value)} />
<input value={lastName} onChange={e => this.changeAuthData('lastName', e.target.value)} />
</div>
)
export default {
state: { firstName: '', lastName: '' }
changeAuthData(name, value) {
this.setState({
...this.state,
[name]: value
})
}
}
@js2me
js2me / vscode_dark++.css
Last active October 26, 2022 11:19
VS code common dark theme with neon highlights
.mtk13 {
color: #9cdcfe;
text-shadow: 0 0 2px #100c0f, 0 0 5px #ffdda926, 0 0 10px #fff3;
}
.mtk12 {
color: #ffdda9;
text-shadow: 0 0 2px #100c0f, 0 0 5px #ffdda926, 0 0 10px #fff3;
}
@js2me
js2me / README.md
Last active July 1, 2019 08:58 — forked from roachhd/README.md
EMOJI cheatsheet ๐Ÿ˜›๐Ÿ˜ณ๐Ÿ˜—๐Ÿ˜“๐Ÿ™‰๐Ÿ˜ธ๐Ÿ™ˆ๐Ÿ™Š๐Ÿ˜ฝ๐Ÿ’€๐Ÿ’ข๐Ÿ’ฅโœจ๐Ÿ’๐Ÿ‘ซ๐Ÿ‘„๐Ÿ‘ƒ๐Ÿ‘€๐Ÿ‘›๐Ÿ‘›๐Ÿ—ผ๐Ÿ”ฎ๐Ÿ”ฎ๐ŸŽ„๐ŸŽ…๐Ÿ‘ป

EMOJI CHEAT SHEET

Emoji emoticons listed on this page are supported on Campfire, GitHub, Basecamp, Redbooth, Trac, Flowdock, Sprint.ly, Kandan, Textbox.io, Kippt, Redmine, JabbR, Trello, Hall, plug.dj, Qiita, Zendesk, Ruby China, Grove, Idobata, NodeBB Forums, Slack, Streamup, OrganisedMinds, Hackpad, Cryptbin, Kato, Reportedly, Cheerful Ghost, IRCCloud, Dashcube, MyVideoGameList, Subrosa, Sococo, Quip, And Bang, Bonusly, Discourse, Ello, and Twemoji Awesome. However some of the emoji codes are not super easy to remember, so here is a little cheat sheet. โœˆ Got flash enabled? Click the emoji code and it will be copied to your clipboard.

People

:bowtie: ๐Ÿ˜„

@js2me
js2me / build_output.js
Created July 5, 2019 05:52
Rollup, terser - mangle options true with reserved keywords
var n,e;n=this,e=function(n){var e;!function(n){n.t="@ONLY_STRINGS",n.o="@ONLY_STRINGS",n.i="@ONLY_STRINGS",n.u="@STRING_AND_CLASS",n.s="@SERIALIZERS"}(e||(e={}));var t,o=function(n){return"object"==typeof n&&null!==n&&!(n instanceof Array)},r=function(n){return!("object"==typeof n||n instanceof Array||"function"==typeof n)},i=function(){for(var n=[],e=0;arguments.length>e;e++)n[e]=arguments[e];throw console.error.apply(console,["โ—๏ธ : "].concat(n)),Error("โ—๏ธ : Exception based on message above")},u=function(){for(var n=[],e=0;arguments.length>e;e++)n[e]=arguments[e];console.warn.apply(console,["โš ๏ธ : "].concat(n))},f=function(){return(f=Object.assign||function(n){for(var e,t=1,o=arguments.length;o>t;t++)for(var r in e=arguments[t])({}).hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}).apply(this,arguments)},a=function(n,e){return null!==n&&u('Not possible to cast value "',n,'" to type '+e+".")},c=function(n,e){var t=Object.keys(p);return-1===t.indexOf(n)&&i("Type ",n," of value of property ",e," is not possble f