Skip to content

Instantly share code, notes, and snippets.

View vschoener's full-sized avatar
💭
New Year's resolution coming :)

Vincent Schoener vschoener

💭
New Year's resolution coming :)
View GitHub Profile
@vschoener
vschoener / mysql-docker.sh
Created March 22, 2018 22:04 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@vschoener
vschoener / history.ts
Created July 26, 2018 11:47
history.ts
import { createBrowserHistory } from 'history';
export default createBrowserHistory();
import authReducer, { AuthStateInterface } from '../components/auth/authReducer';
// Interface inside my reducer file
// export interface AuthStateInterface {
// authenticated?: string | null;
// }
export interface IAppState {
//... Other state you need here
auth: AuthStateInterface;
}
@vschoener
vschoener / index.tsx
Created July 26, 2018 11:50
React index
import * as React from 'react';
import { render as ReactRender } from 'react-dom';
import { Provider } from 'react-redux';
import { Router, Route } from 'react-router-dom';
import './scss/main.scss';
import SignIn from './components/auth/signin/SignIn';
import SignUp from './components/auth/signup/SignUp';
import Event from './components/dashboard/event/Event';
import AuthorizedRoute from './hoc/AuthorizedRouteHOC';
@vschoener
vschoener / AuthorizedRouteHOC.tsx
Last active July 26, 2018 11:56
Restrict authenticated routes on React with Typescript
import { Route } from 'react-router-dom';
import { connect } from 'react-redux';
import { IAppState } from '../reducers/index';
import { RouteProps } from 'react-router';
import history from '../config/history';
interface Props extends RouteProps {
authenticated: string | null;
}
FROM node:11.4 as base
WORKDIR /app
# use changes to package.json to force Docker not to use the cache
# when we change our application's nodejs dependencies:
COPY package*.json /tmp/
RUN cd /tmp && npm install --quiet
RUN cp -r /tmp/node_modules /app
import express from 'express';
import http from 'http2';
const app = express();
app.get('/', () => { message: 'Hellow Docker and TypeScript' });
http.createServer(app).listen('8080', () => {
console.log('Ready fox! I\'m listening')
version: "3.8"
services:
app:
container_name: dockertsdev_app
command: npm run start:dev
build: .
volumes:
- .:/app
# Don't forget this part, it's really important
all: clean down build
build:
docker-compose build
build-nc:
docker-compose build --no-cache
start:
docker-compose up
@vschoener
vschoener / tsconfig.json
Last active December 30, 2018 17:14
Docker & TypeScript development
{
// This attribute will hold all the compile option of TypeScript
"compilerOptions": {
// Where are located your source code
"rootDir": "src",
// Where you want to put our compiled code
"outDir": "build",
// Which ES library you want to include