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 / react.d.ts
Created Nov 27, 2019
Get props type from React component
View react.d.ts
type Propsable = {
FC: React.FC;
C: React.Component;
CC: React.ComponentClass<any>;
F: (...args: any) => any;
}
type PropsOfFC<C extends Propsable["FC"]> = {
[K in keyof C["propTypes"]]: C["propTypes"][K] extends React.Validator<infer P>
? P
: K
View dotline.ts
export const DotLine = styled.div<{ size: number, count: number, distance: number }>`
background: black;
width: ${({ size }) => `${size}px`};
height: ${({ size }) => `${size}px`};
opacity: 0.65;
border-radius: ${({ size }) => `${size / 2}px`};
box-shadow: ${({ count, distance }) => count === 1 ? 'none' : Array(count-1).fill(1).map((_, i) => `0 ${(i+1) * distance}px`).join(', ')};
margin-top: ${({ distance, size }) => `${distance * -(size + size/2)}px`};
@js2me
js2me / style.css
Created Nov 11, 2019
Point background
View style.css
.background {
background-image: radial-gradient(#D7D7D7 1px, transparent 1px), radial-gradient(#ffc6c6 1px, transparent 1px);
background-position: 0 0, 25px 25px;
background-size: 50px 50px;
}
@js2me
js2me / index.d.ts
Created Oct 31, 2019
Sexy common TypeScript types
View index.d.ts
type Mutate<T, PropertyName extends keyof T, NewValue> = Omit<T, PropertyName> & {
[K in keyof T]: K extends PropertyName ? NewValue : T[K];
}
type PickAndOmit<TPick, TOmit, PropertyName extends (keyof TPick & keyof TOmit)> = Pick<TPick, PropertyName> & Omit<TOmit, PropertyName>
@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;
}
You can’t perform that action at this time.