This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package controllers | |
import ( | |
"fmt" | |
"net/http" | |
"github.com/techinscribed/repository-db/models" | |
) | |
// BaseHandler will hold everything that controller needs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useContext } from 'react'; | |
import { Button } from '@material-ui/core'; | |
import { ThemeContext} from './ThemeProvider'; | |
const App: React.FC = () => { | |
// Get the setter function from context | |
const setThemeName = useContext(ThemeContext) | |
return ( | |
<div className="App"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"semi": true, | |
"singleQuote": true, | |
"trailingComma": "none", | |
"tabWidth": 2, | |
"useTabs": false, | |
"bracketSpacing": true | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { withAuthenticator } from 'aws-amplify-react'; | |
function App() { | |
return ( | |
... | |
) | |
} | |
export default withAuthenticator(App, { | |
includeGreetings: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ADD_TODO, REMOVE_TODO } from '../actions/todos'; | |
const changes = {}; | |
let currentVersion = -1; | |
const noOfVersionsSupported = 100; | |
const undoableActions = [ADD_TODO, REMOVE_TODO]; | |
export default function(state = initialState, action) { | |
return produce(state, draft => { | |
// ... code removed for brevity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"editor.multiCursorModifier": "ctrlCmd", | |
"editor.snippetSuggestions": "bottom", | |
"window.zoomLevel": 0, | |
"workbench.colorCustomizations": { | |
"statusBar.background": "#000", | |
"statusBar.border": "#222", | |
"statusBar.foreground": "#02bb7d", | |
"sideBar.background": "#081014", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const disconnectEpic = (action$, state$: StateObservable<IState>) => | |
action$ | |
.ofType(WebsocketActionTypes.DISCONNECT) | |
.mergeMap((action: IDisconnectFromWebsocketAction) => { | |
if (action.payload.retry) { | |
return of(connect(state$.value.config.webSocketURL)) // <-- reconnect | |
.delay(5000) | |
.startWith(disconnected()); | |
} | |
onCloseSubject.complete(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const connectEpic = (action$, state$: StateObservable<IState>) => | |
action$ | |
.ofType(WebsocketActionTypes.CONNECT) | |
.switchMap((action: IConnectWebsocketAction) => | |
connectSocket(state$.value.eventConfig.webSocketURL) | |
.map(data => receiveMessageFromWebSocket(data)) // <-- Map and fire receive action | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Detect successfull connection by listening to onOpenSubject | |
const connectedEpic = action$ => | |
action$.ofType(WebsocketActionTypes.CONNECT).switchMap(() => | |
onOpenSubject.map(() => { | |
return connected(); | |
}) | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { combineEpics, StateObservable } from 'redux-observable'; | |
import { of } from 'rxjs'; | |
import { Subject } from 'rxjs/Subject'; | |
import { webSocket, WebSocketSubject } from 'rxjs/webSocket'; | |
import { | |
connected, | |
connect, | |
disconnected, | |
disconnect, | |
IConnectWebsocketAction, |