How to backup LinkedIn saved posts manually

What?

To export account data from LinkedIn website can be of a lot of muddle and hassle, but the result may not be yet decent for the missing saved posts.

Let’s do this in a manual automated way by scripting.

Solution

Code snippet for saving data as a downloadable JSON file (source):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
(function(console){
console.save = function(data, filename){

if(!data) {
console.error('Console.save: No data')
return;
}

if(!filename) filename = 'console.json'

if(typeof data === "object"){
data = JSON.stringify(data, undefined, 4)
}

var blob = new Blob([data], {type: 'text/json'}),
e = document.createEvent('MouseEvents'),
a = document.createElement('a')

a.download = filename
a.href = window.URL.createObjectURL(blob)
a.dataset.downloadurl = ['text/json', a.download, a.href].join(':')
e.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null)
a.dispatchEvent(e)
}
})(console)

This line looks weird, just an ad-hoc cure when the error of undefined $ occurs with the arrow function operating on the jQuery selector. The cause of error still remains a mystery…

Read more

Good to know about ReactJS

  • Declarative

  • Component-based

    encapsulate behaviors into small units called Components
    Components are made of elements.
    Components enable us to break down the entire UI in to smaller reusable pieces.
    can have private states to control.
    Only class components can store states.

  • Component Methods

  • Component State and Lifecycle

  • Element

    smallest building blocks is elements.

  • Basic structure for a component

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    import React, { Component } from 'react';

    class Menu extends Component {
    constructor(props) {
    super(props);
    // Need to supply this props to the super class
    }
    render(){
    return(
    // the view for this component
    );
    }
    }
    export default Menu;
    //need to import this component for wherever we use
  • Every parameter pass to the component is under props.

  • If one component export the default one, there is no need to enclose import component name with braces, otherwise error occurs.

  • JSX: wrapped React Component expression

  • Handling events like handling DOM elements

Good to know about ECMAScript6

  • Variation hoisting

  • Global or local variable?

    var/const/let/[none]

  • Arrow function

    this reference

js ajax发起跨域请求

常见的错误:

No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://xxx.com' is therefore not allowed access.

禁止跨域请求是浏览器的安全机制的一部分,不能随便绕开。

即便采用axios,本质上仍是XMLHttpRequest,会遇到同样的问题。

在不能触及被请求端的后端的前提下,需要使用代理来启用Access-Control-Allow-Origin

现在有了一种便捷手段:https://bird.ioliu.cn/

https://segmentfault.com/q/1010000007665348

2016年上半年写前端的点滴汇总

其实只做了一件事情:写异步回调函数。

附带的成就是知道了如何调用cdn资源,如何使用bootstrap框架,如何jquery.

【160113】PrintService开发记录

第一次发日志,就从【应用过PrintService的】校赛以后说起吧;不折腾不舒服。