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
| <?php | |
| namespace Craft; | |
| // This file could be placed into your public_html folder and visited to import a cheese product. | |
| $craft = require '../craft/app/bootstrap.php'; | |
| $craft->plugins->loadPlugins(); | |
| $newProduct = new Commerce_ProductModel(); |
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
| function Interface(input, output, completer, terminal) { | |
| if (!(this instanceof Interface)) { | |
| return new Interface(input, output, completer, terminal); | |
| } | |
| this._sawReturnAt = 0; | |
| this.isCompletionEnabled = true; | |
| this._sawKeyPress = false; | |
| this._previousKey = null; |
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 default class App extends React.Component { | |
| render() { | |
| return ( | |
| <View style={styles.container}> | |
| <Text>Open up App.js to start working on your app!</Text> | |
| <Text style={styles.bigblue}>Changes you make reload.</Text> | |
| <Text>Shake your phone to open the developer menu.</Text> | |
| </View> | |
| ); | |
| } |
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 webpack = require('webpack'); | |
| const path = require('path'); | |
| module.exports = { | |
| entry: './app/src/index.js', | |
| output: { | |
| path: './app/build', | |
| filename: 'bundle.js', | |
| publicPath: '/' | |
| }, |
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
| function processMovieDetailsResponse(movie) { | |
| const movieDetailTemplate = ` | |
| <div class="movie-detail" data-movie-id="${movie.id}"> | |
| <p><strong>${movie.original_title}</strong></p> | |
| <img src="https://image.tmdb.org/t/p/w185${movie.poster_path}" /> | |
| <p> | |
| <em>Genres:</em> | |
| <ul> | |
| ${displayGenres(movie.id, movie.genres)} | |
| </ul> |
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
| let faker = require('faker') | |
| const getRandom = (arr) => arr[Math.floor(Math.random()*arr.length)] | |
| const createCombos = (foodNames, foodTypes) => foodNames.map( (item, index) => `${getRandom(foodTypes)} ${item}`) | |
| const foodNames = ['Samosa', 'Sandwich', 'Roll', 'Pattice'] | |
| const foodTypes = ['Non Veg', 'Veg', 'Jain'] | |
| function Combo() { | |
| return { |
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 names = ['Alice', 'Bob', 'Tiff', "Sonny", 'Bruce', 'Alice', "Sonny"]; | |
| //output shoule be { 'Alice': 2, 'Bob': 1, 'Tiff': 1, 'Bruce': 1 } | |
| var initialValue = {}; | |
| var reducer = (names, stats) => { | |
| (!names[stats]) ? names[stats] = 1 | |
| : names[stats] = names[stats] + 1; |
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 expect from 'expect'; | |
| import * as courseActions from './courseActions'; | |
| import * as types from './actionTypes'; | |
| import thunk from 'redux-thunk'; | |
| import nock from 'nock'; | |
| import configureMockStore from 'redux-mock-store'; | |
| // Test a sync action | |
| describe('Course Actions', () => { |
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
| // Functional setState (Recommended) | |
| this.setState(prevState => { | |
| const newState = { | |
| ...prevState.data, | |
| transactions: [...data, prevState.data.transactions] | |
| } | |
| return { data: newState } | |
| }) |
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 handleChange = (fieldName) => (event) => { | |
| this.setState(fieldName, event.target.value) | |
| } | |
| <input type="text" onChange={handleChange('email')} ... /> |