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-native'; | |
| import myStyles from '../styles/styles'; | |
| import Colors from '../styles/colors'; | |
| import NavigationBar from 'react-native-navbar'; | |
| import {AudioPlayer} from 'react-native-audio'; | |
| let { | |
| Text, | |
| View, | |
| TouchableHighlight, |
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
| var Meteor = require('meteor-client'); | |
| // This implements `Meteor.connect` | |
| var DDP = require('ddp'); | |
| var Mongo = require('mongo'); | |
| let Messages = new Mongo.Collection('messages'); | |
| class CCNative extends React.Component{ | |
| constructor(props){ | |
| super(props); |
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
| const React = require('react-native'); | |
| var Icon = require('react-native-vector-icons/FontAwesome'); | |
| let { | |
| View, | |
| Text, | |
| Animated, | |
| StyleSheet, | |
| TextInput, | |
| TouchableHighlight, | |
| ScrollView, |
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
| // css | |
| @-webkit-keyframes fadeOut { | |
| 0% {opacity: 0;} | |
| 10% {opacity: 1;} | |
| 90% {opacity: 1;} | |
| 100% {opacity: 0;} | |
| } | |
| @keyframes fadeOut { | |
| 0% {opacity: 0;} |
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
| ... | |
| componentDidMount: function() { | |
| // make elements sortable when editMode == true | |
| var self = this; | |
| SortedElements = Sortable.create(simpleList, { | |
| onEnd: function (/**Event*/evt) { | |
| var oldIndex = evt.oldIndex -1; // element's old index within parent | |
| var newIndex = evt.newIndex -1; // element's new index within parent | |
| if (oldIndex != undefined && newIndex != undefined) { | |
| // swap old and new elements in sidebar list |
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
| // chat_room.jsx | |
| submitMessage: function(e) { | |
| e.preventDefault(); | |
| var message = $(e.target).find('input').val(); | |
| $(e.target).find('input').val(''); | |
| Streamy.emit(`outgoing_chat.${this.props._id}`, { from: this.getUsername(), message: message }); | |
| }, | |
| Streamy.on(`incoming_chat.${this.props._id}`, function(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
| // chat_room.jsx | |
| submitMessage: function(e) { | |
| e.preventDefault(); | |
| var message = $(e.target).find('input').val(); | |
| $(e.target).find('input').val(''); | |
| Streamy.emit('outgoing_chat', { from: this.getUsername(), message: message }); | |
| }, | |
| Streamy.on('incoming_chat', function(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
| class ChargesController < ApplicationController | |
| def create | |
| customer = Stripe::Customer.create( | |
| :email => 'example@stripe.com', | |
| :card => params[:stripeToken] | |
| ) | |
| @charge = Charge.new( | |
| price: params[:charge]["amount"].to_i, | |
| user_id: current_user.id, | |
| vendor_id: params[:charge]["owner_id"].to_i, |
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 ChargesController < ApplicationController | |
| def new | |
| end | |
| def complete | |
| @charge = Charge.find(params[:charge_id]) | |
| @puppy = Puppy.find_by(user_id: @charge.user_id, | |
| arrived: false, name: @charge.item) | |
| Stripe.api_key = ENV["stripe_api_key"] |
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
| ## user.rb | |
| class User < ActiveRecord::Base | |
| .... | |
| has_many :puppies, dependent: :destroy | |
| has_many :paid_charges, class_name: 'Charge', | |
| foreign_key: 'user_id', dependent: :destroy | |
| has_many :received_charges, class_name: 'Charge', | |
| foreign_key: 'vendor_id', dependent: :destroy | |
| end | |
| ## puppy.rb |