Skip to content

Instantly share code, notes, and snippets.

🥝
Available

Sergey S. Volkov js2me

🥝
Available
Block or report user

Report or block js2me

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@js2me
js2me / mock-console.ts
Created Jul 31, 2019
Mock console.warn console.log console.error
View mock-console.ts
const mockedMethods = ['log', 'warn', 'error']
export const { originalConsoleFuncs, consoleMessages } = mockedMethods.reduce(
(acc: any, method: any) => {
acc.originalConsoleFuncs[method] = console[method].bind(console)
acc.consoleMessages[method] = []
return acc
},
{
@js2me
js2me / fixed-header-sticky-table.css
Created Jul 26, 2019
FIxed header in table using pure css (position: sticky)
View fixed-header-sticky-table.css
.fixed-header-table { overflow-y: auto; height: 100px; }
.fixed-header-table thead th {
position: sticky;
top: 0;
/* don't use border, just use box-shadow */
box-shadow: 0 1px 0 #c6c7c9;
}
table { border-collapse: collapse; width: 100%; }
@js2me
js2me / base_helpers.js
Created Jul 22, 2019
Basic helpers which reduce your code (most of them are polyfills)
View base_helpers.js
/**
* Check value on type which contains in arrayOfTypeNames
*
*
* Examples:
* valueIs('example', ['String']) -> true
* valueIs({}, ['String', 'Number']) -> false
*
* @param {any} value
@js2me
js2me / build_output.js
Created Jul 5, 2019
Rollup, terser - mangle options true with reserved keywords
View build_output.js
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
@js2me
js2me / README.md
Last active Jul 1, 2019 — forked from roachhd/README.md
EMOJI cheatsheet 😛😳😗😓🙉😸🙈🙊😽💀💢💥💏👫👄👃👀👛👛🗼🔮🔮🎄🎅👻
View README.md

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 / vscode_dark++.css
Last active Jun 18, 2019
VS code common dark theme with neon highlights
View vscode_dark++.css
.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;
}
View stonex-auth-module.js
export default {
state: { firstName: '', lastName: '' }
changeAuthData(name, value) {
this.setState({
...this.state,
[name]: value
})
}
}
View stonex-reactjs-example.jsx
// 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>
)
View reactjs-component.jsx
class Login extends React.Component {
changeForm = ({ target }) => {
this.setState({ [target.name]: target.value })
}
render() {
const { firstName, lastName } = this.state
return (
View stonex-pure-module-example.js
// ./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 })
}
}
You can’t perform that action at this time.