Do anybody know how to turn back on console log and alerts in Adminator (webpack based, link below). Have tried to turn off each plugin one by one, both production and development mode, unsuccessfully.
I assume that uglifyJsPlugin is responsible, but even changing compress parameters to false didn't work.
https://github.com/puikinsh/Adminator-admin-dashboard
in webpack.config.js
// ---------------------------
// #Merging Production Plugins
// ---------------------------
if (manifest.IS_PRODUCTION) {
plugins.push(
new webpack.optimize.UglifyJsPlugin({
compress: {
comparisons : true,
conditionals : true,
dead_code : false,
drop_debugger : false,
evaluate : true,
if_return : true,
join_vars : true,
screw_ie8 : true,
sequences : true,
unused : true,
warnings : false,
},
output: {
comments: false,
},
})
);
}
Can you please disable drop_console attribute to false and check with below config.
Reference : compress-options
// ---------------------------
// #Merging Production Plugins
// ---------------------------
if (manifest.IS_PRODUCTION) {
plugins.push(
new webpack.optimize.UglifyJsPlugin({
compress: {
comparisons : true,
conditionals : true,
dead_code : false,
drop_debugger : false,
evaluate : true,
if_return : true,
join_vars : true,
screw_ie8 : true,
sequences : true,
unused : true,
warnings : false,
drop_console : false
},
output: {
comments: false,
},
})
);
}
Related
I have written the following code in my project
$('[data-fancybox]').fancybox({
// Options will go here
infobar: false,
buttons : [
"zoom",
"slideShow",
//"fullScreen",
//"download",
"thumbs",
"close"
],
wheel : false,
transitionEffect: "slide",
// thumbs: false,
// hash : false,
// keyboard : true,
toolbar: true,
// animationEffect : false,
// arrows : true,
clickContent: false,
afterLoad: function() {
if (!$('.fancybox-button--play').hasClass("fancybox-button--pause")) {
$('.fancybox-button--play').trigger('click');
}
}
});
That code is not executing... however, When I execute it in console it perfectly works... What I am doing wrong?
Please try to load your script under "$( document ).ready()"
Below is the JSON i received from server.
Now i am having variable public checkId: any = 54
How to extract data corresponding to ID = 54 from below JSON ??
I want to extract below that is mentioned against KEY 54
"Increase Again": true,
"Decrease Previous" : true,
"Like" : true,
"Dislike" : true,
"Old Again" : false,
"Others" : true
Below is the JSON from which i have to extract above data
{
"27" : {
"Increase": true,
"Decrease" : true,
"Like" : true,
"Dislike" : true,
"Old" : false,
"Others" : true
},
"54" : {
"Increase Again": true,
"Decrease Previous" : true,
"Like" : true,
"Dislike" : true,
"Old Again" : false,
"Others" : true
},
"104" : {
"Increase Previous": true,
"Decrease Prior" : true,
"Like" : true,
"Dislike" : true,
"Old" : false,
"Others Check" : true
}
}
Thanks in advance ...
#Edit - The key are not simply 1,2,3 they are specific Id 53,54,55 also it can 100, 108, 4657
You can simply get the specific element by passing the checkId in your response, For instance I'm assuming that you have that JSON in result variable.
You can call it in the following way
let result = //Your json;
let checkId = 2;
result[checkId] ==> This will return 2nd object of JSON
You Can get Ur Desired Value simply like this..
let checkId = 2;
let data = {
"1": {
"Increase": true,
"Decrease": true,
"Like": true,
"Dislike": true,
"Old": false,
"Others": true
},
"2": {
"Increase Again": true,
"Decrease Previous": true,
"Like": true,
"Dislike": true,
"Old Again": false,
"Others": true
},
"3": {
"Increase Previous": true,
"Decrease Prior": true,
"Like": true,
"Dislike": true,
"Old": false,
"Others Check": true
}
}
let result = data[checkId]
console.log(result)
Let's say I have a big list of items where the user can go and favourite items as they wish. These favourites then go to a new node userLikedItems/userUID/.
When saving favourites, I am trying to figure out the best way to do so:
Here is my current, duplicative approach:
//duplicating all the data when a user favourites an item into their own node under userLikedItems
{
"hwUjzftGyCgMrRgNv4Djg5F4ZCQ2" : {
"24K Carrot" : {
"effects" : {
"Euphoria" : true,
"Happy" : true,
"Relaxing" : true,
"Sleepy" : true
},
"medical" : {
"Arthritis" : true,
"Bipolar Disorder" : true,
"Chronic Pain" : true,
"Depression" : true,
"Fatigue" : true,
"Inflammation" : true,
"Insomnia" : true,
"Loss of Appetite" : true,
"Migraines" : true,
"PTSD" : true,
"Stress" : true
},
"levels" : "18% - 24%",
"title" : "24K Carrot",
"titleLowercase" : "24k Carrot",
"uid" : "24K Carrot"
},
"2 Pac" : {
"effects" : {
"Cerebral" : true,
"Focus" : true,
"Happy" : true,
"Horny" : true,
"Relaxing" : true,
"Uplifting" : true
},
"medical" : {
"Arthritis" : true,
"Cramps" : true,
"Depression" : true,
"Gastrointestinal Disorder" : true,
"Loss of Appetite" : true,
"Migraines" : true
},
"levels" : "29%",
"title" : "2 Pac",
"titleLowercase" : "2 pac",
"uid" : "2 Pac"
},
}
}
Here is the next approach where I am trying to determine if it is a better practice than my current approach:
//data stored with only uid:true under user's favourites node
{
"hwUjzftGyCgMrRgNv4Djg5F4ZCQ2" : {
"24K Carrot" : true,
"2 Pac" : true,
"Triple Take" : true,
}
// fetching the rest of the data inside list item
componentDidMount() {
firebase.database().ref('/userLikedItems').child(this.props.user.item.uid).once('value', snapshot => {
const itemData = snapshot.val();
this.setState({
name: itemData.name,
image: itemData.image,
type: itemData.type
});
});
}
So basically when a list item is mounted I am calling this query to fetch the rest of the data. I am worried this is a bad practice.
Right now I am currently duplicating all the item data in the userLikedItems node which means I would not have to perform that query for every item, instead I would simply load all the data from the users node - the problem with this is I have to use a cloud function to keep the data consistent when the main item changes and there is a lot of duplicate data in my database when it could instead just be a simple boolean for each item.
I appreciate all the feedback!
Cheers.
Atom-typescript changes tab space from 2 to 4 when we format the code.
I changed formatting.js file and set it to 2 but still i'm facing the same issue..
How can i change the tab space in atom-typescript?
below is the content of formatting.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Maintainance:
* When a new option is added add it to:
* - the FormatCodeOptions interface
* - the defaultFormatCodeOptions function
* - the makeFormatCodeOptions function
*/
const os_1 = require("os");
function defaultFormatCodeOptions() {
return {
baseIndentSize: 2,
indentSize: 2,
tabSize: 2,
newLineCharacter: os_1.EOL,
convertTabsToSpaces: true,
indentStyle: "Smart",
insertSpaceAfterCommaDelimiter: true,
insertSpaceAfterSemicolonInForStatements: true,
insertSpaceBeforeAndAfterBinaryOperators: true,
insertSpaceAfterKeywordsInControlFlowStatements: true,
insertSpaceAfterFunctionKeywordForAnonymousFunctions: false,
insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false,
insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false,
insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: false,
insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: false,
placeOpenBraceOnNewLineForFunctions: false,
placeOpenBraceOnNewLineForControlBlocks: false,
};
}
exports.defaultFormatCodeOptions = defaultFormatCodeOptions;
//# sourceMappingURL=formatting.js.map
As suggested by #baruch, here is the reference: github.com/TypeStrong/atom-typescript/issues/1236
I'm posting what worked for me.
To change indentation to 2 for atom-typescript:
Go to your project directory.
Open or create tsconfig.json.
Add the following code
"formatCodeOptions": {
"baseIndentSize": 0,
"indentSize": 2,
"tabSize": 2,
"newLineCharacter": "\n",
"convertTabsToSpaces": true,
"indentStyle": "Smart",
"insertSpaceAfterCommaDelimiter": true,
"insertSpaceAfterSemicolonInForStatements": false,
"insertSpaceBeforeAndAfterBinaryOperators": true,
"insertSpaceAfterConstructor": false,
"insertSpaceAfterKeywordsInControlFlowStatements": true,
"insertSpaceAfterFunctionKeywordForAnonymousFunctions": false,
"insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": false,
"insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": false,
"insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": false,
"insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": false,
"insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces": false,
"insertSpaceBeforeFunctionParenthesis": false,
"placeOpenBraceOnNewLineForFunctions": false,
"placeOpenBraceOnNewLineForControlBlocks": false
}
This worked for me!
How to show hints and define dictionary with ui-codemirror?
$scope.cmOption = {
lineWrapping : true,
lineNumbers: true,
textWrapping: true,
indentWithTabs: true,
readOnly: false,
mode: "javascript",
matchBrackets: true,
autoCloseBrackets: true,
gutters: ["CodeMirror-lint-markers"],
lint: true,
showHint: true
};
I tried with ng-codemirror-dictionary-hint but it gives me an error
instance.showHint is not a function