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
"devDependencies": { | |
"autoprefixer": "^7.1.1", | |
"babel-core": "^6.25.0", | |
"babel-eslint": "^7.2.3", | |
"babel-loader": "^7.0.0", | |
"babel-plugin-syntax-decorators": "^6.13.0", | |
"babel-plugin-transform-class-properties": "^6.24.1", | |
"babel-plugin-transform-decorators-legacy": "^1.3.4", | |
"babel-plugin-transform-runtime": "^6.23.0", | |
"babel-preset-es2015": "^6.24.1", |
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
Show hidden characters
{ | |
"plugins": [ | |
"transform-class-properties", | |
"syntax-decorators", | |
"transform-decorators-legacy" | |
], | |
"presets": [ | |
["es2015", { "modules": false }], | |
"react", | |
"stage-0" |
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 webpack = require('webpack'); | |
const path = require('path'); | |
const DashboardPlugin = require('webpack-dashboard/plugin'); | |
const HtmlWebpackPlugin = require('html-webpack-plugin'); | |
const ExtractTextPlugin = require('extract-text-webpack-plugin'); | |
const SpritePlugin = require('svg-sprite-loader/plugin'); | |
const autoprefixer = require('autoprefixer'); | |
const nodeEnv = process.env.NODE_ENV || 'development'; |
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
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1", | |
"dev": "webpack-dashboard -t \"music react demo\" -- webpack-dev-server", | |
"build": "rm -rf ./build && NODE_ENV=\"production\" webpack", | |
"preview": "rm -rf ./build && NODE_ENV=\"production\" webpack-dashboard -t 'Preview - music react demo' -- webpack-dev-server" | |
}, |
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 the package | |
import SpeechAndroid from 'react-native-android-voice'; | |
... | |
async _buttonClick() { | |
try{ | |
// THIS EASY! | |
var spokenText = await SpeechAndroid.startSpeech("Speak into the Mic!", SpeechAndroid.GERMAN); | |
ToastAndroid.show(spokenText , ToastAndroid.LONG); | |
}catch(error){ |
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
if (data.length === 0 && helperClass.isValid(Math.ceil(data.someValue))) { | |
runFunctionA(data); | |
} else { | |
runFunctionB(data); | |
} |
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 dataIsEmpty = data.length === 0; | |
const valueCeil = Math.ceil(data.someValue); | |
const valueCeilIsValid = helperClass.isValid(valueCeil); | |
if (dataIsEmpty && valueCeilIsValid) { | |
runFunctionA(data); | |
} else { | |
runFunctionB(data); | |
} |
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 dataIsEmpty = data.length === 0; | |
const valueCeil = Math.ceil(data.someValue); | |
const valueCeilIsValid = helperClass.isValid(valueCeil); | |
dataIsEmpty && valueCeilIsValid ? runFunctionA(data) : runFunctionB(data); |
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
// bad | |
function setSidebar() { | |
$('.sidebar').hide(); | |
// ... | |
$('.sidebar').css({ | |
'background-color': 'pink', | |
}); | |
} |
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
// normal loop | |
for (var i = 0; i < array.length; i++) { | |
console.log(array[i]); | |
} | |
// optimized loop | |
for (var i = array.length - 1; i >= 0; i--) { | |
console.log(array[i]); | |
} |
OlderNewer