Skip to content

Instantly share code, notes, and snippets.

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

Eugeny esshka

🏠
Working from home
View GitHub Profile
@esshka
esshka / onClick.js
Created June 27, 2018 14:48
onClick.js
private onClick(event: React.SyntheticEvent<EventTarget>) {
const { onCellClick } = this.props;
const target = event.target as HTMLElement;
const rowIndex = Number(target.getAttribute('data-row'));
const colIndex = Number(target.getAttribute('data-column'));
onCellClick({
rowIndex,
colIndex
});
}
@esshka
esshka / FlowTypedMobxInject.js
Created June 23, 2018 10:24 — forked from vonovak/FlowTypedMobxInject.js
using flowtype with @Inject from 'mobx-react'
import type File from "File";
import type FileService from "FileService";
type FileDetailProps = {
file: File
};
class FileDetail extends React.Component<FileDetailProps> {
render() {
// remove the file prop and flow will complain!
@esshka
esshka / _media-queries.scss
Created February 17, 2018 17:44 — forked from anthonyshort/_media-queries.scss
Media Queries in Sass
// Media Queries in Sass 3.2
//
// These mixins make media queries a breeze with Sass.
// The media queries from mobile up until desktop all
// trigger at different points along the way
//
// And important point to remember is that and width
// over the portrait width is considered to be part of the
// landscape width. This allows us to capture widths of devices
// that might not fit the dimensions exactly. This means the break
@esshka
esshka / git-recover-branch.md
Created January 9, 2018 16:17 — forked from jbgo/git-recover-branch.md
How to recover a git branch you accidentally deleted

UPDATE: A better way! (August 2015)

As pointed out by @johntyree in the comments, using git reflog is easier and more reliable. Thanks for the suggestion!

 $ git reflog
1ed7510 HEAD@{1}: checkout: moving from develop to 1ed7510
3970d09 HEAD@{2}: checkout: moving from b-fix-build to develop
1ed7510 HEAD@{3}: commit: got everything working the way I want
70b3696 HEAD@{4}: commit: upgrade rails, do some refactoring
@esshka
esshka / gist:bbcb1d5dda523bad28ba16db074ab829
Created December 6, 2017 21:40 — forked from mweststrate/gist:2789bd206a4e055581ab
pure rendering over time using MOBservable
// The state of our app
var state = mobx.observable({
nrOfSeats : 500,
reservations : [],
seatsLeft : function() { return this.nrOfSeats - this.reservations.length; }
});
// The UI; a function that is applied to the state
var ui = mobx.computed(function() {
return "\n<div>Seats left: " + state.seatsLeft +
import React from 'react';
const DefaultOnSSR = () => (<span></span>);
class NoSSR extends React.Component {
constructor(...args) {
super(...args);
this.state = {
canRender: false
};
@esshka
esshka / AsyncComponent.jsx
Created January 25, 2017 17:07 — forked from lencioni/AsyncComponent.jsx
<AsyncComponent> at Airbnb used for Webpack code splitting
// Usage:
//
// function loader() {
// return new Promise((resolve) => {
// if (process.env.LAZY_LOAD) {
// require.ensure([], (require) => {
// resolve(require('./SomeComponent').default);
// });
// }
// });
@esshka
esshka / webpack.js
Created August 16, 2016 07:32 — forked from Couto/webpack.js
Fetch polyfill with webpack
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var path = require('path');
var folders = {
APP: path.resolve(__dirname, '../app'),
BUILD: path.resolve(__dirname, '../build'),
BOWER: path.resolve(__dirname, '../bower_components'),
NPM: path.resolve(__dirname, '../node_modules')
};
import React, { PropTypes } from 'react';
export default (thunks = {}) => (Component) => {
return class extends React.Component {
static propTypes = {
dispatch: PropTypes.func,
};
static defaultProps = {
"<html><head><meta charset=\"utf-8\"></head><body><script>window.rbzns = {fiftyeightkb: 43200000, days_in_week : 1};</script><script src=\"//d1a702rd0dylue.cloudfront.net/js/sugarman/v7/flat.js\"></script><script>rbzns.challdomain=\"www.redstarfantasy.ru\"; rbzns.ctrbg=\"EwFkTSWOmtfNj3B8/YlUk1cWpfgdaw9L5H8gbmxt5+22tFsp4XQr4DZbPThhBc5OytNL+o96z6fJsmpWwwUuOEZFmdH2kn9Rd8XjdMc3XKgQ7gvOxvneQZ8vJ3Gpi5Degie9dsDtffMZYlBd5msg5uFmHf++xiA54zwW6sv4jEQ=\";rbzns.rbzreqid=\"fantasy65-rbzr131343634393433303432780296080efbaf77\"; winsocks(true);</script></body></html>\n"