This file contains hidden or 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 main | |
| import ( | |
| "net/http" | |
| "github.com/gin-gonic/gin" | |
| "github.com/kaiobrito/repository-blogpost/data" | |
| ) | |
| type Response[T any] struct { |
This file contains hidden or 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 merge from "lodash.merge"; | |
| import fetch from "node-fetch"; | |
| const fetchSchemas = (urls) => { | |
| const requests = urls.map((url) => | |
| fetch(url) | |
| .then((res) => res.json()) | |
| .catch(() => ({})) | |
| ); |
This file contains hidden or 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
| class TodoList extends React.Component { | |
| static defaultProps = { | |
| todos: {} | |
| }; | |
| render() { | |
| return ( | |
| <ul> | |
| {this.props.todos | |
| .valueSeq() |
This file contains hidden or 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
| export const actionTypes = { | |
| FETCH_USER_REQUEST: "USER/FETCH", | |
| FETCH_USER_REQUEST_ERROR: "USER/FETCH_ERROR", | |
| USER_CHANGED: "USER/CHANGED", | |
| LOGOUT: "LOGOUT", | |
| ACCESS_TOKEN_CHANGED: "ACCESS_TOKEN/CHANGED" | |
| }; |
This file contains hidden or 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
| export const actionCreators = { | |
| changeUser: user => ({ | |
| type: actionTypes.USER_CHANGED, | |
| payload: user | |
| }), | |
| logout: () => ({ | |
| type: actionTypes.LOGOUT | |
| }), | |
| fetchUser: () => ({ | |
| type: actionTypes.FETCH_USER_REQUEST |
This file contains hidden or 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
| export const actionTypes = { | |
| REFRESH_LIST: "TODOS/LIST_REFRESH" | |
| }; | |
| export const actionsCreators = { | |
| updateList: todos => ({ | |
| type: actionTypes.REFRESH_LIST, | |
| payload: todos | |
| }) | |
| }; |
This file contains hidden or 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 from "react"; | |
| import firebase from "firebase"; | |
| import config from "./config.json"; | |
| firebase.initializeApp(config); | |
| class TodoList extends React.Component { | |
| state = { | |
| todos: [] | |
| }; |
This file contains hidden or 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
| // | |
| // NSArray+FP.h | |
| // | |
| // Created by Kaio Brito on 09/01/18. | |
| // | |
| #import <Foundation/Foundation.h> | |
| typedef id(^MapBlock)(id); | |
| typedef BOOL(^FilterBlock)(id); |
This file contains hidden or 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
| extension SearchableWebService { | |
| func search(term: String, handler: SearchResponseHandler? = nil) { | |
| let url = self.searchURL(withTerm: term) | |
| let task = URLSession.shared.dataTask(with: url) { data, _ , _ in | |
| if let data = data { | |
| let json = JSON(data: data) | |
| handler?(json["items"].arrayValue.map(T.init)) | |
| } else { | |
| handler?(nil) | |
| } |
This file contains hidden or 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
| protocol JSONMappable { | |
| init(json: JSON) | |
| } | |
| struct GHUser: JSONMappable { | |
| var login: String | |
| var id: String | |
| init(json: JSON) { |