Skip to content

Instantly share code, notes, and snippets.

View adaniliuk's full-sized avatar

Andrei Daniliuk adaniliuk

  • United States
View GitHub Profile
@adaniliuk
adaniliuk / ismobile.js
Created March 18, 2015 06:35
Check if mobile from JavaScript
'use strict';
module.exports = {
/**
* Checks for iOs, Android, Blackberry, Opera Mini, and Windows mobile devices
* Based on http://www.detectmobilebrowsers.com
*
* @return {Boolean} True if user agent is mobile
*/
isMobile: function() {
@adaniliuk
adaniliuk / mirror.css
Created April 1, 2015 06:26
Mirror page :)
body {
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
-ms-filter: "FlipH";
transform: rotateY(180deg);
}
@adaniliuk
adaniliuk / isInputDateSupported.js
Created April 6, 2015 12:28
Checks if html5 input type date is supported
'use strict';
module.exports = {
/**
* Checks if html5 input date is supported
*
* @return {Boolean} True if html5 input date is supported by the client browser
*/
isInputDateSupported: function () {
var el = document.createElement('input'),
import { PropTypes, Children } from 'react';
import classNames from 'classnames';
/**
* Defines whether it's server or client side rendering environment (can use DOM client side)
*
* @type {Boolean}
*/
const canUseDOM = !!(
typeof window !== 'undefined' &&
@adaniliuk
adaniliuk / updating-external-data-when-props-changes-using-promises.js
Created December 3, 2018 21:48 — forked from bvaughn/updating-external-data-when-props-changes-using-promises.js
Example for loading new external data in response to updated props
// This is an example of how to fetch external data in response to updated props,
// If you are using an async mechanism that does not support cancellation (e.g. a Promise).
class ExampleComponent extends React.Component {
_currentId = null;
state = {
externalData: null
};