Skip to content

Instantly share code, notes, and snippets.

View robinpokorny's full-sized avatar

Robin Pokorny robinpokorny

View GitHub Profile
// with static data, do filtering and sorting in the client
<Autocomplete
initialValue="Ma"
items={getUnitedStates()}
getItemValue={(item) => item.name}
shouldItemRender={(item, value) => (
state.name.toLowerCase().indexOf(value.toLowerCase()) !== -1 ||
state.abbr.toLowerCase().indexOf(value.toLowerCase()) !== -1
)}
sortItems={(a, b, value) => (
@bahmutov
bahmutov / index.js
Last active April 7, 2016 14:08
Is it pure?
// A: is this pure function?
function sum(a, b) { return a + b }
// B: is this a pure function?
const k = 2
function addK(a) { return a + k }
// C: is this a pure function?
function sub(a, b) { return sum(a, -b) }
// D: is this a pure function?
function sub(a, b, summer) { return summer(a, b) }
// E: is this a pure function?
@steida
steida / OfflinePage.react.jsx
Last active August 19, 2016 10:10
Stateless functional component with decorators (not available yet)
import Helmet from 'react-helmet';
import React from 'react';
import linksMessages from '../../common/app/linksMessages';
import { FormattedMessage } from 'react-intl';
import { connect } from 'react-redux';
import { fields } from '../../common/lib/redux-fields';
@fields({
path: 'offline',
fields: [
@steida
steida / OfflinePage.react.jsx
Created August 16, 2016 23:35
React stateless functional component with higher order component wrappers.
import Helmet from 'react-helmet';
import React from 'react';
import linksMessages from '../../common/app/linksMessages';
import { FormattedMessage } from 'react-intl';
import { connect } from 'react-redux';
import { fields } from '../../common/lib/redux-fields';
let OfflinePage = ({ fields, online }) => (
<div className="offline-page">
<FormattedMessage {...linksMessages.offline}>
@bloodyowl
bloodyowl / Component.js
Created January 4, 2017 15:16
Component library in less than 140 bytes
b=0;$=x=>(p,i="_"+b++,u=($[i]=q=>eval(i).innerHTML=x(p,$[q],u),z=>($[++b]=z,`$.${i}(${b})`)))=>`<c id=${i}>${x(p,[]._,u)}</c>`
@bestander
bestander / gist:a8a07724138a7e89392de1a795a82ef9
Created March 9, 2017 17:50
When I need to make sure that people are on the same build tool for a project
"scripts": {
"preinstall": "if [[ '$npm_config_user_agent' != *'yarn'* ]]; then echo 'Use Yarn!'; exit 0; fi"
}
@jmahc
jmahc / style.css
Last active September 6, 2017 15:05
Operator Mono Collection & Styling for Atom Text Editor (Operator Mono/Pro/ScreenSmart)
/* CSS for VS Code */
/*
Feel free to remove these comments - just documenting why we do what we do...
*/
/* This is the left-hand pane or "tree-view" */
.monaco-split-view,
/* These are for any `.js` or `.jsx` files */
.editor-container[data-mode-id~="javascript"],
.editor-container[data-mode-id~="javascriptreact"] {
@machal
machal / pravidla.md
Last active September 18, 2018 13:26
FB/Frontendisti – pravidla

Pravidla diskuzní skupiny Frontendisti.cz

Skupina je spravována pro podporu komunity http://frontendisti.cz/.

  1. DRŽÍME TÉMA
    Diskutujeme hlavně o frontendu – CSS, HTML, JS se souvisejícími přesahy (backend, design). Tématu se držíme v otevřených diskuzích.
  2. NESPAMUJEME
    Nabídky práce patří na pracovní forum Frontendistů. https://www.facebook.com/groups/frontendistiprace/ Reklama na produkty a služby sem nepatří.
  3. NELADÍME CHYBY SOFTWARE
@nemoDreamer
nemoDreamer / styles.less
Created May 20, 2017 12:16
Subtle italics in Atom syntaxes
atom-text-editor.editor {
.syntax--punctuation.syntax--whitespace.syntax--comment.syntax--leading,
.syntax--source {
font-family: FiraCode-Retina; // https://github.com/tonsky/FiraCode
text-rendering: optimizeLegibility;
letter-spacing: 0;
}
.syntax--string.quoted,
.syntax--string.regexp {
@robinpokorny
robinpokorny / HttpStatusCode.ts
Created April 13, 2021 21:38
All HTTP status codes in TypeScript const Enums
export const enum InformationalResponse {
Continue = 100,
SwitchingProtocols = 101,
Processing = 102,
EarlyHints = 103,
}
export const enum Success {
OK = 200,
Created = 201,