Skip to content

Instantly share code, notes, and snippets.

Catching the sun

Dmitry Polushkin dmitry

Catching the sun
Block or report user

Report or block dmitry

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
dmitry /
Last active Oct 2, 2016
elasticsearch date historgram
curl -XGET 'http://localhost:42001/bookings/booking/_search?&pretty=true' -d '{
  "aggs": {
    "test": {
      "filter": {
        "terms": {
          "status": ["accepted"]
      "aggs": {
dmitry / elasticsearch_logger.js
Created Aug 24, 2016
Elasticsearch script logger (javascript)
View elasticsearch_logger.js
var logger=org.elasticsearch.common.logging.ESLoggerFactory.getLogger('myscript');;
dmitry / plain_mail.rb
Created Apr 29, 2016
Use ActionMailer config to send plain through plain Mail
View plain_mail.rb
Mail.defaults do
delivery_method ActionMailer::Base.delivery_method, ActionMailer::Base.smtp_settings
mail = Mail.deliver do
to ''
from 'Mikel Lindsaar <>'
subject 'First multipart email sent with Mail'
text_part do
dmitry / trackable_links.rb
Last active Dec 2, 2015
Add trackable links
View trackable_links.rb
dmitry /
Created Sep 23, 2015 — forked from paulirish/
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.


Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
dmitry / Enhance.js
Last active Sep 17, 2015 — forked from sebmarkbage/Enhance.js
Higher-order Components
View Enhance.js
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
componentDidMount() {
this.setState({ data: 'Hello' });
render() {

React now supports the use of ES6 classes as an alternative to React.createClass().

React's concept of Mixins, however, doesn't have a corollary when using ES6 classes. This left the community without an established pattern for code that both handles cross-cutting concerns and requires access to Component Life Cycle Methods.

In this gist, @sebmarkbage proposed an alternative pattern to React mixins: decorate components with a wrapping "higher order" component that handles whatever lifecycle methods it needs to and then invokes the wrapped component in its render() method, passing through props.

While a viable solution, this has a few drawbacks:

  1. There's no way for the child component to override functionality defined on the higher order component.
You can’t perform that action at this time.