Skip to content

Instantly share code, notes, and snippets.

View gazedash's full-sized avatar
🍰
gazedash.com

Andrey Efremov gazedash

🍰
gazedash.com
View GitHub Profile
import React from 'react'
const ImageContent = ({ data: { src } }) => {
return (
<div>
<img src={src} />
</div>
)
}
// 21:13
// Given urls ['url1', 'url2', 'url2', 'url3'...], limit
// Function `process` should `get` all urls, respecting limit and return when finished.
// Limit means that at the same time there should be N (limit) requests in progress, at least and at most
// Duplicate urls shouldn't be processed again, but the final order should be the same
// Get is used to mock requests
function get(url) {
return Promise.resolve("result" + url);
}
type themes = 'light' | 'dark'
export const themeProps = {
light: {
color1: 'black',
color2: 'white',
dark: 'black',
},
dark: {
color1: 'yellow',
@gazedash
gazedash / PromiseTestTask.js
Last active January 15, 2019 18:10
Promise.then should be executed in the loop, it will not be executed immediately, but will be scheduled as a microTask, and when current loop finish all running job, it will check any microtask is pending or not, if there are, those microtasks will be executed in the same loop.
// What promise resolves faster (what will be printed as value)?
A = new Promise((resolve) => resolve("A"))
.then((a) => a)
.then((a) => {
console.log(a);
return a;
});
B = new Promise((resolve) => resolve("B"))
@drums (drums) + (gain 10)
play @drums
(rhythm [2n])
(notes [3 1 5 4 6 7 8 2 4 5])
@melody (adsr (osc [sine])) + (gain 0.2) + (filter hp 1) + (delay 1n 0.4 1 7) + (pan (lerp -1 1 16))
@melody2 (adsr (osc [square])) + (gain 0.1)
play @melody
import React, { Component } from "react";
import "./GameResults.css";
class GameResults extends Component {
constructor(props) {
super(props);
this.state = {};
}
@gazedash
gazedash / howto
Created March 19, 2018 14:46 — forked from hilkeheremans/howto
Fonts in React Native for Android vs iOS
REACT NATIVE IOS vs ANDROID FONT USE
Tested for React Native 0.41+
IOS:
- Place the fonts in the assets and make sure they are bundled along
- On iOS, fontFamily in Text match the Font Family name as described in Font Book (macOS). Font weights can be specified exactly.
ANDROID:
On Android, there are two ways of using fonts:
/* @flow */
import _ from 'lodash';
import u from 'updeep';
import { handleActions } from 'redux-actions';
import { typicalMetaState, typicalMetaUnknownError, typicalSimpleMetaState } from '../utils/index';
import * as AT from '../constants/ActionTypes';
import type { IResponseHandler, TypicalAction, TypedAction } from '../typings';
import type {
IQuestionQueueState,
IQuestionQueueItem,
$ npm set init.author.name "Your Name"
$ npm set init.author.email "[email protected]"
$ npm set init.author.url "http://yourblog.com"
$ npm adduser
@gazedash
gazedash / .dotfiles
Last active December 15, 2017 15:42
dot files
# git config branch.master.rebase true
git config --global branch.autosetuprebase always