Skip to content

Instantly share code, notes, and snippets.

View olegchursin's full-sized avatar
🐬
Common sense isn't very common.

Oleg Chursin olegchursin

🐬
Common sense isn't very common.
View GitHub Profile
@olegchursin
olegchursin / html-escapes.js
Created October 9, 2019 04:19
HTML Escapes
const html_escapes = {
'&': '&',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#39;',
};
@olegchursin
olegchursin / js-escapes.js
Created October 9, 2019 04:17
JS escapes
const jsEscapes = {
'\\': '\\u005C',
'\'': '\\u0027',
'"': '\\u0022',
'>': '\\u003E',
'<': '\\u003C',
'&': '\\u0026',
'=': '\\u003D',
'-': '\\u002D',
';': '\\u003B',
// Create a Chrome bookmark and use the code as the URL. Toggle the css-layout on/off
// thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3
javascript: (function() {
const element = document.querySelector('#test-layout-styles');
if (element) {
document.head.removeChild(element);
} else {
const style = document.createElement('style');
style.id = 'test-layout-styles';
@olegchursin
olegchursin / vscode-settings.json
Last active September 6, 2019 16:40
VS Code settings.json example.
{
"workbench.colorCustomizations": {
"activityBar.background": "#050d14",
"activityBar.foreground": "#e7e7e7",
"activityBar.inactiveForeground": "#e7e7e799",
"activityBarBadge.background": "#90cf10",
"activityBarBadge.foreground": "#15202b",
"titleBar.activeBackground": "#cd108f",
"titleBar.inactiveBackground": "#cd108f99",
"titleBar.activeForeground": "#e7e7e7",
@olegchursin
olegchursin / tslint.json
Created July 10, 2019 14:07
Sample tslint.json config
{
"rulesDirectory": ["node_modules/codelyzer"],
"rules": {
"arrow-return-shorthand": true,
"callable-types": true,
"class-name": true,
"comment-format": [true, "check-space"],
"curly": true,
"eofline": true,
"forin": true,
@olegchursin
olegchursin / example.jsx
Created May 1, 2019 05:48 — forked from bvaughn/LICENSE.md
Advanced example for manually managing subscriptions in an async-safe way using hooks
import React, { useMemo } from "react";
import useSubscription from "./useSubscription";
// In this example, "source" is an event dispatcher (e.g. an HTMLInputElement)
// but it could be anything that emits an event and has a readable current value.
function Example({ source }) {
// In order to avoid removing and re-adding subscriptions each time this hook is called,
// the parameters passed to this hook should be memoized.
const subscription = useMemo(
() => ({
#header {
font-family: Roboto;
background-color: #252429;
color: #ff59d8;
border-color: #f513f5;
}
#user-tools a {
color: #4fffff;
}
@olegchursin
olegchursin / settings.json
Created October 27, 2018 22:32
Sample settings.json for VSCode
{
"workbench.colorCustomizations": {
"titleBar.activeForeground": "#000",
"titleBar.inactiveForeground": "#000000CC",
"titleBar.activeBackground": "#17FFFF",
"titleBar.inactiveBackground": "#17FFFF"
}
}
@olegchursin
olegchursin / StickyFooter.md
Last active September 12, 2018 07:05
Sticky footer

Sticky Footer

Flexbox way

The HTML

<body class="Site">
  <header>…</header>
  <main class="Site-content">…</main>
  <footer>…</footer>
@olegchursin
olegchursin / Readme.md
Created February 18, 2018 03:39 — forked from mxstbr/Readme.md
Enable tab completion for JSX with Emmet in Atom

Enable tab completion for JSX with Emmet in Atom

This guide assumes you have the emmet and language-babel packages already installed in Atom

Gif of the tab completion working

  1. Open the keymap.cson file by clicking on Atom -> Keymap… in the menu bar
  2. Add these lines of code to your keymap:
'atom-text-editor[data-grammar~="jsx"]:not([mini])':