Skip to content

Instantly share code, notes, and snippets.

View shikelong's full-sized avatar
🏠
Working from home

shikelong shikelong

🏠
Working from home
View GitHub Profile
@shikelong
shikelong / get-sharepoint-access-token.py
Created November 11, 2020 08:50 — forked from demelziraptor/get-sharepoint-access-token.py
Code example to get a Sharepoint Access Token to use with the Sharepoint REST API using a python 3 provider-hosted Sharepoint App (using cherrypy). This code takes the data POSTed to it when you click on the app in Sharepoint, and authenticates using OAuth to get the access token. To use the Sharepoint REST API with OAuth, the app needs to be re…
import cherrypy
import jwt
import urllib.parse, urllib.request
import json
SPSECRET = 'gpYucHkODHOv6JxZJ89Kihl9ncTiTrUCAbOaF1N6uJE='
cherrypy.config.update({'server.socket_port': 3005,
'server.ssl_module': 'builtin',
'server.ssl_certificate': 'cert.pem',
@shikelong
shikelong / Demo.js
Last active December 15, 2020 01:21
VideoPlay History
recordVideoPlayHistory('testVideo', {
"EmailOrUserName": "[email protected]",
"WatchTokenOrPwd":"ayr1",
"LoginToken": "C52AC508-8778-E5FC-95F3-35DDDB21BBC1",
"UserType": 1
}, guid(), 7);
@shikelong
shikelong / dom_performance_reflow_repaint.md
Created July 6, 2020 09:35 — forked from faressoft/dom_performance_reflow_repaint.md
DOM Performance (Reflow & Repaint) (Summary)

DOM Performance

Rendering

  • How the browser renders the document
    • Receives the data (bytes) from the server.
    • Parses and converts into tokens (<, TagName, Attribute, AttributeValue, >).
    • Turns tokens into nodes.
    • Turns nodes into the DOM tree.
  • Builds CSSOM tree from the css rules.
@shikelong
shikelong / question1_variable_scope.js
Created July 3, 2020 14:16
Javascript Language Issues
'use strict';
var i;
for(let i = 0; i< 1; i++){
//let i = 12;
//var i = 13;
//i = 20;
}
//以上写法有几种会报错。原因是为什么?
//Write a function called strictEquals(a, b) that returns the same value as a === b. Your implementation must not use the === or !== operators.
function strictEquals(a, b){
if (Number.isNaN(a) || Number.isNaN(b)){
return false;
}
//+0/-0
if (isEqual(a, -0) && isEqual(b, +0) || isEqual(a, +0) && isEqual(b, -0)){
return true;
}
return Object.is(a, b);
@shikelong
shikelong / Object-is.js
Created June 29, 2020 06:24
JavaScript Simple Polyfill
//different with ==, object.is not implict convert
//object is 判断 NaN/+-0 相等行为和 === 不同
if (!Object.is) {
Object.is = function(x, y) {
// SameValue algorithm
if (x === y) { // Steps 1-5, 7-10
// Steps 6.b-6.e: +0 != -0
return x !== 0 || 1 / x === 1 / y;
} else {
// Step 6.a: NaN == NaN
function test(){
return 'hi, Notion';
}
@shikelong
shikelong / cloudSettings
Last active February 15, 2017 14:00
Sync Setting for vscode
{"lastUpload":"2017-02-15T14:00:53.626Z","extensionVersion":"v2.4.3"}
my Atom Config Back Up