Skip to content

Instantly share code, notes, and snippets.

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

Konstantin Tarkus koistya

🏠
Working from home
View GitHub Profile
@koistya
koistya / 0x4AC7C6CF.asc
Last active August 16, 2018 09:31
My GPG Key (hello@tarkus.me)
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFt1MBkBEADHMdrirvRavPbX74YwnYLDKBYF+TKG+2S2Yzrqe7reAXbwU4+l
Rf2CWWfaNuyNg5sInjWs9jdzgrwOx3faJZBl/2TnabY7xMutgKTkh3hXF6Oy2OEu
C+stYR4vzQHLrXGMH0iCjhxICh29On7Swk1OsY7R+4B1gmcSZ2FqyBBK4feM0Yb1
LJJ/K+xCJQ3KkoUnogA/n7utHDWRjTIdZsObeVxBln0D4fagPMPmDg0Jlup/THfk
SLKqG0FBCVS6dW8GS+GwIib3OzXeOpD3va99qvSg77gZTtf9LVtlwbYmgT0AUh3Z
a9ewxdup3yf/sIsBtg2K1FpKqp0gOtnafHy46zbQ8jkzNA58sVPyXsMIdPx3THV5
M4ttIv0ateoJ9NWedk68eM6Ysg5lPaJ9Oxs5A7s1ojN5Y15vNNEnu0biF/67w59x
97iSvuywQv1qoZWeN8KzsIOr5kCs48qUMauknuijMBph4nPIGbSapKs50B3HTaZZ
@koistya
koistya / deploy.sh
Last active August 16, 2018 09:32
Deploy a specific Git commit to Firebase using Cloud Build. Example: ./deploy.sh $COMMIT_SHA
#!/bin/bash
COMMIT_SHA=$1
PROJECT=bay6-next
REPO_NAME=github-<user/organisation>-<repo>
BUILD_BUCKET=gs://builds.example.com
TOKEN=$(gcloud auth application-default print-access-token)
curl https://cloudbuild.googleapis.com/v1/projects/${PROJECT}/builds \
--request POST \
function FindProxyForURL(url, host){
return "PROXY 127.0.0.1:1081; DIRECT";
}
@koistya
koistya / auth.js
Last active December 17, 2017 20:34
Doing common JavaScript tasks without Redux https://medium.com/p/f23ffbbb02ae
import '@firebase/auth';
import firebase from '@firebase/app';
const callbacks = new Set();
export default {
signIn() {
const provider = new firebase.auth.FacebookAuthProvider();
return firebase.auth().signInWithPopup(provider);
},
@koistya
koistya / LoginDialog.js
Last active December 17, 2017 20:29
Doing common JavaScript tasks without Redux https://medium.com/p/f23ffbbb02ae
import auth from '../auth';
const defaultState = { error: null, loading: false };
class LoginDialog extends React.Component {
state = { ...defaultState };
signIn = event => {
this.setState({ ...defaultState, loading: true });
auth
@koistya
koistya / App.js
Last active December 16, 2017 21:31
Doing common JavaScript tasks without Redux https://medium.com/p/f23ffbbb02ae
import auth from '../auth'
class App extends React.Component {
state = { signInOpen: false };
componentDidMount() {
this.offShowSignInDialog = auth.onShowSignInDialog(() => {
this.setState({ signInOpen: true });
});
}
@koistya
koistya / auth.js
Created December 16, 2017 11:30
Doing common JavaScript tasks without Redux https://medium.com/p/f23ffbbb02ae
export default {
showSignInDialog() {/* ... */},
signIn() {/* ... */},
signOut() {/* ... */},
onShowSignInDialog(cb) {/* ... */},
onAuthStateChange(cb) {/* ... */}
}
@koistya
koistya / App.js
Last active August 12, 2017 07:30
The top-level React component for Relay https://medium.com/p/989c078fa892
import React from 'react';
import { graphql, QueryRenderer } from 'react-relay';
import relay from '../relay';
import router from '../router';
import history from '../history';
import AppRenderer from './AppRenderer';
class App extends React.Component {
state = {
@koistya
koistya / relay.js
Created August 11, 2017 18:46
Relay Modern client (environment) https://medium.com/p/989c078fa892
import { Environment, Network, RecordSource, Store } from 'relay-runtime';
function fetchQuery(operation, variables) {
return fetch(
'https://graphql-demo.kriasoft.com/',
{
method: 'POST',
headers: {
// Add authentication and other headers here
'content-type': 'application/json',
@koistya
koistya / index.js
Last active July 4, 2017 14:15
Univeral Router route example to be used with Relay Modern (https://github.com/kriasoft/universal-router)
/* @flow */
import React from 'react';
import { graphql } from 'relay-runtime';
export default {
path: '/leads',
query: graphql`query LeadsQuery {
me { ...Layout_me ...Leads_me }
leads { ...Leads_leads }