Skip to content

Instantly share code, notes, and snippets.

View alexHlebnikov's full-sized avatar

Alexander Khlebnikov alexHlebnikov

View GitHub Profile
@alexHlebnikov
alexHlebnikov / mock-http.js
Created March 20, 2023 17:45 — forked from jofftiquez/mock-http.js
Mock HTTP request in javascript using promise and timeout.
const mock = (success, timeout = 1000) => {
return new Promise((resolve, reject) => {
setTimeout(() => {
if(success) {
resolve();
} else {
reject({message: 'Error'});
}
}, timeout);
});
componentDidMount() {
if(Platform.OS == 'android' && Platform.Version >= 23)
this.getInitialAndroid23Location();
}
getInitialAndroid23Location = async () => {
try {
console.log('Asking for location permission');
const granted = await PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
@alexHlebnikov
alexHlebnikov / location.js
Created October 11, 2017 09:49 — forked from raldred/location.js
Location Component for react native with workaround for Android issue https://github.com/facebook/react-native/issues/7495
export default class Location extends Component {
constructor(props) {
super(props);
this._locationReceived = false;
this._locationWatchID = null;
};
componentDidMount() {
@alexHlebnikov
alexHlebnikov / index.js
Created October 10, 2017 11:13 — forked from earnubs/index.js
HMR with reach-hot-loader3 and webpack 2
import { AppContainer } from 'react-hot-loader';
import React from 'react';
import { Provider } from 'react-redux';
import { createStore } from 'redux';
import { render } from 'react-dom';
import App from './containers/app';
import reducers from './reducers';
// Grab the state from a global variable injected into the server-generated HTML
package ru.doublegis.drugstores;
import android.os.Bundle;
import android.util.Log;
import com.facebook.react.ReactActivity;
import android.content.Intent;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
/* Map.js */
calculateAnnotations() {
const { markers } = this.props;
const annotations = _.map(markers, marker => {
const markerState = {
marker,
animated,
price: marker.price,
@alexHlebnikov
alexHlebnikov / AnimatedImplementation.js
Last active January 18, 2017 05:01 — forked from polacekpavel/AnimatedImplementation.js
tweaked AnimatedImplementation for react-native-mapview (updated for RN 0.34.0)
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule AnimatedImplementation
* @flow
/**
* Print Stylesheet fuer Deinewebsite.de
* @version 1.0
* @lastmodified 16.06.2016
*/
@media print {
/* Inhaltsbreite setzen, Floats und Margins aufheben */
/* Achtung: Die Klassen und IDs variieren von Theme zu Theme. Hier also eigene Klassen setzen */
@alexHlebnikov
alexHlebnikov / genymotionwithplay.txt
Created July 20, 2016 05:35 — forked from wbroek/genymotionwithplay.txt
Genymotion with Google Play Services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
Google Apps for Android 4.4.4 (https://www.androidfilehost.com/?fid=23501681358544845 - gapps-kk-20140606-signed.zip)
Google Apps for Android 4.3 (https://www.androidfilehost.com/?fid=23060877490000124 - gapps-jb-20130813-signed.zip)
@alexHlebnikov
alexHlebnikov / Opinion.md
Created July 13, 2016 10:09 — forked from ALF-er/Opinion.md
ReactJS Conf 2016

Disclaimer 1: Первую которая "про то чего мы достигли" я таки пропустил.

Disclaimer 2: Многие доклады смотрелись и отчёты писались в состоянии алкогольного опьянения.

Сейчас посмотрел Ben Alpert - What Lies Ahead она про то какие идеи они имеют о дальнейшем развитии. И они делят на UX-идеи и DX-идеи. В UX у них: