Skip to content

Instantly share code, notes, and snippets.

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

Rumen Rusanov hpstuff

🏠
Working from home
View GitHub Profile
@hpstuff
hpstuff / main.dart
Last active February 5, 2020 11:41
Flutter Painter animation Demo
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:math';
import 'dart:ui';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
@hpstuff
hpstuff / .bash_profile
Last active February 8, 2023 13:25
terminal
source ~/.local/bin/bashmarks.sh
source ~/.bashrc
source ~/.profile
alias ..="cd .."
alias ...="cd ../.."
alias pgs="phonegap serve"
alias vim="mvim --remote-tab-silent"
alias composer="php /usr/bin/composer.phar"
<CompareWrapper>
{this.renderPlayers}
</CompareWrapper>
renderPlayers(playerIDs, addPlayer) {
return playerIDs.map((playerID) =>
<PlayerWrapper id={playerID}>
{(player) => this.renderPlayer(player, addPlayer)}
</PlayerWrapper>
)
@hpstuff
hpstuff / 00-shema.graphqls
Last active April 12, 2018 08:54
graphql-java
type Link {
url: String!
description: String!
}
type Query {
allLinks: [Link]
}
schema {
@hpstuff
hpstuff / bindNavigationActionCreators.js
Created March 30, 2018 13:25
bindActionCreators with wix navigator included
import { bindActionCreators } from 'redux';
const bindNavigationActionCreator = (actionCreator, navigator) =>
(...args) => ({...actionCreator.apply(this, args), navigator});
export const bindNavigationActionCreators = (actionCreators, dispatch, navigator) => {
if (typeof actionCreators === 'function') {
const boundActionCreator = bindNavigationActionCreator(actionCreators, navigator);
return bindActionCreators(boundActionCreator, dispatch);
}
//@flow
import type { ComponentType } from 'react';
import React from 'react';
import styled from 'styled-components';
type Align = 'flex-start' | 'flex-end' | 'center';
type Props = {
align?: Align;
}
import jwt_decode from 'jwt-decode';
import { setTokens } from '../actions';
import { SET_TOKEN, CLEAR_TOKEN } from '../actions/types';
import * as api from '../api';
const prefix = /^@REQUEST\//;
const refreshToken = (refresh_token, dispatch) =>
api.refresh_token(refresh_token) //call refresh token api
.then(({ authToken, refreshToken }) => {
@hpstuff
hpstuff / TextChangeAnimated.js
Created March 26, 2018 07:31
React Components
class TextChanges extends Component {
constructor(props) {
super(props);
this.state = {
animation: new Animated.Value(0),
currentText: '',
oldText: ''
};
}
startAnimation() {
//let stepOptions = options.slice(0, options.length);
let stepOptions = options.map(({title}, i) => { title, index: [i] });
stepOptions.splice(1, 0, { title: 'Best of Both', index: [0, 1] });
{stepOptions.map((({title, index}), i) => <CheckBox label={title} key={i} value={this.isSelected(index)} onChange={() => onChange(index)} />)}
isSelected(index) {
const { value } = this.props;
class Test {
tokens$: Observable;
message$: Observable;
constructor() {
this.tokens = Observable.create((observer) => {
this.getToken(observer);
this.messaging.onTokenRefresh(() => this.getToken(observer));
});