Skip to content

Instantly share code, notes, and snippets.

View serhiiminin's full-sized avatar
🏠
Working from home

Serhii Minin serhiiminin

🏠
Working from home
View GitHub Profile
@qoomon
qoomon / conventional-commits-cheatsheet.md
Last active July 7, 2024 01:34
Conventional Commits Cheatsheet

Conventional Commit Messages

See how a minor change to your commit message style can make a difference.

Tip

Have a look at git-conventional-commits , a CLI util to ensure these conventions and generate verion and changelogs

Commit Message Formats

Default

@stephenwil
stephenwil / Context.tsx
Created May 29, 2018 09:59
Typescript HOC Context
export const withContext = <P extends {}>(Component: React.ComponentType<P>) =>
class WithContext extends React.PureComponent<P & IAppContext> {
render() {
return (
<AppContext.Consumer>
{(context: any) => <Component {...this.props} {...context} />}
</AppContext.Consumer>
);
}
};
import React, { PropTypes } from 'react';
import cn from 'classnames';
const Button = ({
classes,
children,
tag: Tag,
block,
active,
disabled,
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active July 5, 2024 19:12
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@crittermike
crittermike / App.js
Last active May 9, 2022 08:18
Using Google API (gapi) with React
/* global gapi */
const API_KEY = 'YOURAPIKEYHERE';
import React, { Component } from 'react';
class App extends Component {
loadYoutubeApi() {
const script = document.createElement("script");
@jesperorb
jesperorb / cors.md
Last active February 21, 2024 14:17
Handle CORS Client-side

Handle CORS Client-side

Cross-origin resource sharing (CORS) is a mechanism that allows restricted resources (e.g. fonts) on a web page to be requested from another domain outside the domain from which the first resource was served. This is set on the server-side and there is nothing you can do from the client-side to change that setting, that is up to the server/API. There are some ways to get around it tho.

Sources : MDN - HTTP Access Control | Wiki - CORS

CORS is set server-side by supplying each request with additional headers which allow requests to be requested outside of the own domain, for example to your localhost. This is primarily set by the header:

Access-Control-Allow-Origin
@remarkablemark
remarkablemark / README.md
Last active June 8, 2024 21:48
Classes - ES5 vs ES6

JavaScript Classes - ES5 vs ES6

An example that shows the difference between creating a JavaScript class and subclass in ES5 and ES6.

Reference

@paulirish
paulirish / what-forces-layout.md
Last active July 5, 2024 08:26
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@davidrapin
davidrapin / .profile
Last active January 26, 2024 08:54
Kill WebStorm when frozen (linux)
alias killws="ps -Alf |grep -i webstorm |grep -v grep |awk -F' ' '{print \$4}' |xargs kill -9 "
@itsmattsoria
itsmattsoria / gistfil1.textile
Last active July 3, 2024 05:36
Mac Terminal Cheat Sheet

SHORTCUTS

Key/Command Description
Tab Auto-complete files and folder names
Ctrl + A Go to the beginning of the line you are currently typing on
Ctrl + E Go to the end of the line you are currently typing on
Ctrl + U Clear the line before the cursor
Ctrl + K Clear the line after the cursor
Ctrl + W Delete the word before the cursor
Ctrl + T Swap the last two characters before the cursor