Skip to content

Instantly share code, notes, and snippets.

View normanzb's full-sized avatar
🛵
stay safe

Norman X normanzb

🛵
stay safe
  • Somewhere decentralised
  • London
View GitHub Profile
@normanzb
normanzb / WithUnsafeBytesArgsAggregator.swift
Last active August 22, 2022 11:45
Argument aggregator for avoid nesting withUnsafeBytes
private func argAgregate<ResultType> (
dataObjects: [Data],
callback: (([UnsafeRawBufferPointer]) -> ResultType)
) -> ResultType {
var callbacks = [(([UnsafeRawBufferPointer]) -> Void)]()
let withOutFirstDataObjects = dataObjects.dropFirst()
withOutFirstDataObjects.enumerated().forEach { (index, value) in
callbacks.append { pointers in
dataObjects[index + 1].withUnsafeBytes { pointer in
var newPointers: [UnsafeRawBufferPointer] = []
https://download.developer.apple.com/Developer_Tools/Xcode_12.5.1/Xcode_12.5.1.xip
[Fri Jan 22 2021 16:52:47.487] WARN Require cycle: src/components/library/inputs/index.js -> src/components/library/inputs/buttons.js -> src/components/library/links.js -> src/components/library/inputs/index.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
[Fri Jan 22 2021 16:52:47.490] ERROR Warning: Picker has been extracted from react-native core and will be removed in a future release. It can now be installed and imported from '@react-native-community/picker' instead of 'react-native'. See https://github.com/react-native-community/react-native-picker
[Fri Jan 22 2021 16:52:47.491] WARN Require cycle: src/features/navigation/index.js -> src/features/navigation/withErrorHandling.js -> src/features/navigation/index.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
[Fri Jan 22 2021 16:52:47.492] WARN Require cycle: src/lib/coroutine/Task.js -
const useCallbackWithAutoScopeRenewal = (callback, triggers) => {
const callbackWithLatestScope = useCallback(callback, triggers)
const callbackContainer = useRef({})
callbackContainer.current = callbackWithLatestScope
return (...args) => {
return callbackContainer.current(...args)
}
}

https://developer.akamai.com/blog/2017/03/28/what-you-need-know-about-caching-part-1 https://developer.akamai.com/akamai-101-basics-purging

Configuring Akamai with the Luna Control Center

When configuring caching settings on Akamai’s Luna Control Center, you would utilize Property Manager to set up various rules. The Caching behavior gives you five options in the drop down list:

  • honor origin cache control + expires - indicates that Akamai servers should respect both of the Cache-Control & Expires headers received from your servers.
  • honor origin cache control - indicates that Akamai servers should only respect the Cache-Control header received from your backend servers.
  • honor origin expires - tells the Akamai servers to only respect the Expires header received from your backend servers. Note: when selecting any of these three options, you need to define a default Max-Age which will be used in the case where your servers do NOT return any of the specified headers.
  • cache - lets you define the Time-To
function Ctor() {
}
Ctor.prototype.data = {counter: 0}
Ctor.prototype.bump = function() {this.data.counter++;}
a = new Ctor()
b = new Ctor()
a.bump();
console.log(a.data.counter)
console.log(b.data.counter)
curl 'https://qa-englishlive.ef.com/services/school/TOEFLTOEICTrackingArea/TOEFLTOEICTracking/SaveTrackingLog' -H 'Pragma: no-cache' -H 'Origin: https://qa-englishlive.ef.com' -H 'Accept-Encoding: gzip, deflate, br' -H 'Accept-Language: en-GB,en;q=0.9,zh-CN;q=0.8,zh;q=0.7,zh-TW;q=0.6' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded;charset=UTF-8' -H 'Accept: application/json, text/plain, */*' -H 'Cache-Control: no-cache' -H 'Referer: https://qa-englishlive.ef.com/1/toefl-and-toeic/' -H $'Cookie: ipctr=gb; check=true; AMCVS_18051DE15398CAAA0A490D4C%40AdobeOrg=1; _ga=GA1.2.239495578.1540814459; _gid=GA1.2.1864820545.1540814459; et_uc=1; et_sc=1; VMsi=56250; ptn=None; s_cc=true; EFID=F0A62121-F32B-4098-867B-9B840F95BE62; srperc=10; ctr=gb; lng=en; et_s=is_returning=false&vmsi=56250&partner_code=\'None\'&conversion_page_url=\'https%253A//qa-englishlive.ef.com/en-gb/buy/def
@normanzb
normanzb / bundle.js
Last active February 11, 2024 22:25
typical usage example of amd module
// this file is generated by r.js, by bundling all modules into one js file.
define('module1', function(){
return {
test: function(){console.log(1)};
};
});
define('main',['module1'], function(module1){
return function(){
module1.test();
formula 1:
force = energy / distance
->
distance = energy / force
formula 2:
kinetic energy = .5 * mass * velocity^2
机械刹车(除去人为因素)距离的长短,是由动能Kinetic Energy和刹车力Force决定的:
因为: `力 = 动能 / 距离`
所以:`距离 = 动能 / 力`
而动能本身是这样计算的:
`动能 = 0.5 * 质量 Mass * 速度 Velocity * 速度 Velocity`