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, { Component } from 'react' | |
| import { | |
| Animated, | |
| Platform, | |
| StyleSheet, | |
| TouchableOpacity | |
| } from 'react-native' | |
| import PropTypes from 'prop-types' | |
| import { Icon } from 'react-native-elements' |
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
| { | |
| "slides": [ | |
| { | |
| "id":5, | |
| "title": "VISIT US AT MGACE", | |
| "sub_title":"Get the highest score in Tengen Tetris!", | |
| "image":"https://i.imgur.com/Y79kxFy.png", | |
| "page_link":"https://news.matchroom.net/visit-mgace/", | |
| "target":"_self" | |
| }, |
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
| // Too many nested conditionals | |
| renderCurrentUser() { | |
| const { currentUser, avatarSource } = this.state | |
| const { size, photoStyle } = styles | |
| if (avatarSource) { | |
| return ( | |
| <Image | |
| style={photoStyle} | |
| source={avatarSource} |
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 client from '../utils/client'; | |
| export default class Main extends React.Component { | |
| state = { posts: [] } | |
| componentWillMount() { | |
| const request = client(); | |
| request.get(`${API_ROOT}posts`).then(response => { | |
| return response.data |
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 axios from 'axios'; | |
| import { AsyncStorage } from 'react-native'; | |
| # Works | |
| const client = () => { | |
| let token = `Token eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjoxLCJleHAiOjE1NTkyNjY4MDl9.KlSSy_o-C8eACIgCrDPDCfUp5O6rqNuc1B5v-z7RoSpZmWc9Lo1BbWueZCVpHvkxOIjdZuTXxdR0mvk-CzwtvA'`; | |
| console.log('Token is:', token); | |
| const defaultOptions = { | |
| headers: { |
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 UserDecorator < Draper::Decorator | |
| # code | |
| def most_recent_profile_photo | |
| if object.uploads.present? | |
| object.uploads.where('stage_id IS null').select { |upload| upload.uploadable_type == 'ProfilePhoto' }.last.media.service_url || '' | |
| else | |
| 'https://cdn1.iconfinder.com/data/icons/business-charts/512/customer-512.png' | |
| end | |
| end |
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
| # Comment Form | |
| <%= form_for [@post, Comment.new] do |f| %> | |
| <%= f.text_field :body, placeholder: "Comment", class: "form-control", required: true, size: "30x10" %> | |
| <%= f.submit %> | |
| <% end %> | |
| # Post Controller | |
| def show | |
| @post = Post.find(params[:id]) | |
| end |
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
| def create_candlestick(group) | |
| { | |
| date: group[0], | |
| open: opening_price(group[1]), | |
| close: closing_price(group[1]), | |
| low: lowest_price(group[1]), | |
| high: highest_price(group[1]) | |
| } | |
| end |
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
| def self.most_recent | |
| { data: { base: 'BTC', currency: 'USD', amount: last.price } } | |
| end | |
| def self.recent_prices(market_id = 1, coin = 1) | |
| search = query_elastic(market_id, coin) | |
| return [] unless search.aggregations.present? | |
| time_intervals = search.aggregations.dig('five_time_intervals', 'buckets') | |
| time_intervals.inject([]) do |interval, i| |