Skip to content

Instantly share code, notes, and snippets.

View adrianolsk's full-sized avatar

Adriano Skroch adrianolsk

  • Wealthsimple
  • Calgary, Canada
View GitHub Profile
// 1
import { peopleReducer as peopleState } from './reducers/peopleReducer.ts';
import { combineReducers } from 'redux';
export const rootReducer = combineReducers({
peopleState,
});
export type AppState = ReturnType<typeof rootReducer>;
@adrianolsk
adrianolsk / my-connected-component.tsx
Created July 22, 2019 17:56 — forked from aheitzmann/my-connected-component.tsx
A best practice pattern for defining and using typescript types for a redux-react connected component
import * as React from 'react'
import * as Redux from 'redux'
import { MyReduxState } from './my-root-reducer.ts'
export interface OwnProps {
propFromParent: number
}
interface StateProps {
@adrianolsk
adrianolsk / flutter_cheatsheet.md
Created December 28, 2018 12:55 — forked from vmwsree/flutter_cheatsheet.md
Cheat Sheet For Flutter

Container to be full width

constraints: BoxConstraints.expand() so the child a column can have expanded

Outlined Text Box

TextField(
  controller: _usernameController,
  decoration: InputDecoration(
@adrianolsk
adrianolsk / Android Privacy Policy Template
Created December 12, 2018 13:41 — forked from alphamu/Android Privacy Policy Template
A template for creating your own privacy policy for Android apps. Look for "[" and "<!--" to see where you need to edit this app in order to create your own privacy olicy.
<html>
<body>
<h2>Privacy Policy</h2>
<p>[Individual or Company Name] built the [App Name] app as a [open source | free | freemium | ad-supported | commercial] app. This SERVICE is provided by [Individual or company name] [at no cost] and is intended
for use as is.</p>
<p>This page is used to inform website visitors regarding [my|our] policies with the collection, use, and
disclosure of Personal Information if anyone decided to use [my|our] Service.</p>
<p>If you choose to use [my|our] Service, then you agree to the collection and use of information in
relation with this policy. The Personal Information that [I|we] collect are used for providing and
improving the Service. [I|We] will not use or share your information with anyone except as described
@adrianolsk
adrianolsk / install-docker.sh
Created August 6, 2018 00:28 — forked from dweldon/install-docker.sh
Install docker CE on Linux Mint 18.3
#!/usr/bin/env bash
# https://docs.docker.com/install/linux/docker-ce/ubuntu/
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable"
sudo apt-get update
sudo apt-get install docker-ce
# https://docs.docker.com/compose/install/
@adrianolsk
adrianolsk / app.js
Created March 25, 2018 15:38 — forked from acdlite/app.js
Quick and dirty code splitting with React Router v4
// getComponent is a function that returns a promise for a component
// It will not be called until the first mount
function asyncComponent(getComponent) {
return class AsyncComponent extends React.Component {
static Component = null;
state = { Component: AsyncComponent.Component };
componentWillMount() {
if (!this.state.Component) {
getComponent().then(Component => {
@adrianolsk
adrianolsk / redirect_browser_language.nginx
Created December 1, 2017 14:25 — forked from varnav/redirect_browser_language.nginx
Nginx can redirect to language subsite based on browser language
map $http_accept_language $index_redirect_uri {
default "/en/";
"~(^|,)en.+,ru" "/en/";
"~(^|,)ru.+,en" "/ru/";
"~(^|,)en" "/en/";
"~(^|,)ru" "/ru/";
}
location = / {
return 302 $index_redirect_uri;
/* SINPPET FOR DELETED & DELETED AT SUPPORT IN KNEX.JS
inspired from Sequlize.js 'paranoid' schema option,
don't delete rows from database, ever.
*/
/* In Table Definition */
knex.schema.createTable('TABLE_NAME', function(table) {
table.boolean('deleted').defaultsTo(false).notNullable();
table.dateTime('deleted_at');
@adrianolsk
adrianolsk / gist:c0136f483e7c7ac150fc310b01ccb7b8
Last active August 17, 2017 13:34 — forked from Maruz/gist:9274096e436f83e59524bdd09b6cc030
React conditional component rendering
<nav className='navbar'>
{
userRole === 'admin' && (
<AdminPanel />
) || userRole === 'user' && (
<UserPanel />
) || (
<StatusPanel />
)
}
@adrianolsk
adrianolsk / authentication.js
Created August 14, 2017 16:31 — forked from marshallswain/authentication.js
Example tools for using querystring redirects with Feathers OAuth login.
'use strict';
const authentication = require('feathers-authentication');
const jwt = require('feathers-authentication-jwt');
const local = require('feathers-authentication-local');
const oauth2 = require('feathers-authentication-oauth2');
const GithubStrategy = require('passport-github');
// Bring in the oauth-handler
const makeHandler = require('./oauth-handler');