Skip to main content

Posts

working code for chrome extension (Solution for "refused to execute inline script")

{ "short_name" : "React-Todo" , "name" : "My React Extention" , "manifest_version" : 2 , "browser_action" : { "default_popup" : "index.html" , "default_title" : "React Ext" }, "version" : "1.0" , "content_security_policy" : "script-src 'self' 'sha256-5As4+3YpY62+l38PsxCEkjB1R4YtyktBtRScTJ3fyLU='; object-src 'self'" } There might be an error related to sha. Check the error in the console log, it will log a sha .. replace the sha value with the value in the console log Good reference Link : https://codeburst.io/how-to-build-a-cross-browser-new-tab-apps-using-react-ba7d223ca6c6

react redux summary code

const {createStore} = Redux const initState = {   todos: [],   posts: [] } function myreducer(state = initState, action){   console.log(action, state)   if(action.type == 'ADD_TODO') {     return {       ...state,       todos: [...state.todos , action.todo ]     }   }     if(action.type == 'ADD_POST') {     return {       ...state,       posts: [...state.posts , action.posts ]     }   } } const store = createStore(myreducer) store.subscribe(() => {   console.log("state updates")   console.log(store.getState()) }) const todoAction = {   type: 'ADD_TODO',   todo: 'buy milk' } //dispatch action store.dispatch(todoAction) store.dispatch({type: 'ADD_TODO', todo: 'heera'}) store.dispatch({type: 'ADD_TODO', todo: 'keera'}) store.dispatch({type: 'ADD_POST', posts: 'POSTA ENTRY'})

append values to an array in elasticsearch

PUT updateindextest/type1/1 {     "counter" : 1,     "roka" : ["red"] } PUT updateindextest/type1/2 {     "counter" : 2,     "roka" : ["sdf"] } POST /updateindextest/type1/_update_by_query?pretty {   "script": { "inline": "ctx._source.roka.add(params.hits)", "params": {"hits": "pila"}   },   "query": { "match_all": {} } } GET updateindextest/_search?pretty {   "query": {     "match_all": {}   } }

add new multiple fields to elasticsearch index

Update by Query POST testindex_script_en/_update_by_query {   "script": {     "source" : "ctx._source.category_id = '111' ;  ctx._source.category_value = 'category1'; ctx._source.slug = 'file_slug' ;  ctx._source.tag_ids= [1,2,3] ; ctx._source.tag_values = ['t1','t2', 't2'] ; ctx._source.created_time = '2019-05-28 12:53:11' ; ctx._source.file = '/home/testdir' "   } }