0%

使用TagWriter制作一枚可以打开指定网站的NFC标签

nfc 标签

nfc app

iOS 13 开放了 NFC 标签读取功能,你的 iPhone 还能这么玩

具体操作

捷径 > 自动化 > 点击右上角 + 号 > 创建个人自动化;在弹出的动作选项「设置」分类下,找到「NFC」;点击「扫描」,将手机靠近 NFC 标签,建议贴紧;设备检测到 NFC 后弹出标签命名框,为标签命名,保存;选择读取 NFC 标签后的下一步操作,例如拨打电话、打开 WiFi、播放音乐等;去掉「运行前询问」的勾选,这是非常影响体验的关键步骤,如果运行前还要在手机上确认的话,NFC 标签的智能化就大打折扣了。

有,iphone6s怎么使用nfc功能教程
首先我们在手机打开桌面的——-【系统设置】功能键。

接着在常用选项栏目或全部选项下方查看,各个手机界面有所不同。
通常情况带有NFC功能的手机多见于内置在【无线网络】或WiFi的【更多。。。】子栏目下。

进入无线和网络更多。。栏目后就可以看见NFC功能的开启按钮了。
向右滑动即可打开NFC功能。

打开NFC按钮后点击进入NFC设置面页——【勾选】相应的模式即可。

开启NFC功能后,不仅能和另一部支持NFC的手机相互传送文件,还可以使用支持NFC芯片的公交卡、地铁、刷卡、支付宝读取等功能。前提是你所在的地方运营商已经支持NFC应用。

nfc功能目前只支持apple pay,苹果支付,没有其他意义

###iphone 用 NFC 标签配合快捷指令实现场景自动化

2019-09-11-nfc-1.jpg

分别是 NFC 卡片(有圆形也有矩形)、NFC 贴纸和 NFC 滴胶卡。我个人比较推荐的是后两种——贴纸和滴胶卡,它们在使用上会更灵活,贴纸可以贴在家里的任意位置2 ,滴胶卡则方便随身携带。这些 NFC 标签都非常便宜,每个在 1 块钱左右,有的还能定制外观。

iPhone 支持扫描多种 NFC 标签,包括比较流行的 NTAG、MIFARE、ICODE 等。我购买的是 NTAG 系列的标签,在淘宝等电商平台上也比较好购买。其中 NTAG 标签有 213、215、216 等型号,主要区别是储存容量的大小,一般买最小的 213 就足够使用。

Open browser on scan of NFC tag in Android

Open browser on scan of NFC tag in Android

That is because you are writing a text record with the text “http://www.google.com" to the tag. NFC devices usually do not know how to interpret text on tags (though they could just display that text – and some devices do exactly that).

What you want to do is create a record based on the NFC Forum’s URI Record Type Definition. The createRecord method could look like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
private NdefRecord createRecord(String uri) throws UnsupportedEncodingException {
byte[] uriBytes = uri.getBytes("UTF-8");
byte[] payload = new byte[1 + uriBytes.length];

// set prefix byte (see URI RTD for possibile values, we just use 0 indicating no prefix for now)
payload[0] = 0;

// copy uriBytes into payload
System.arraycopy(uriBytes, 0, payload, 1, uriBytes.length);

return new NdefRecord(NdefRecord.TNF_WELL_KNOWN,
NdefRecord.RTD_URI,
null,
payload);
}

Or you could just use Android’s built-in method:

record = NdefRecord.createUri(“http://www.google.com");

Regarding the detection on other devices: Using a MIFARE Classic tag on the S3 should work. The S4 (and any other device based on Broadcom’s NFC chipset) does not support MIFARE Classic at all, so you would need to switch to another tag technology to support those devices.


NFC标签上的URL与NFC标签上的纯文本消息不同。它们具有不同的消息类型。您的清单中列出了2个用于纯文本消息的意图过滤器(实际上不会触发最后一个过滤器,TAG_DISCOVERED意图将永远不会包含来自标记的任何数据)。
要匹配示例网址,请尝试:

1
2
3
4
5
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED"/>
<data android:scheme="http" android:host="www.google.com" />
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>

height: 100vh = 100% of the viewport height

height: 100% = 100% of the parent’s element height

That is why you need to add height: 100% on html and body, as they don’t have a size by default

Something you have to know : if you use % for vertical margin or padding, % will be calculated on the width of the parent element, not the height.

Tip : try using vh and vw units for font size :) I like this one (not supported in some browsers I know) : font-size: calc(.5vh + .5vw); (for example)

Generator

function* 这种声明方式(function关键字后跟一个星号)会定义一个生成器函数 (generator function),它返回一个 Generator 对象。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function* g(i) {
yield i;
yield i + i;
}

let a = g(3);
// console.log(a)

console.log(a.next().value);
console.log(a.next().value);
console.log(8888);

function *foo() {
yield 1;
yield 2;
yield 3;
return;
}
for(let v of foo()) {
console.log(v);
}

yield

yield关键字使生成器函数执行暂停,yield关键字后面的表达式的值返回给生成器的调用者。它可以被认为是一个基于生成器的版本的return关键字。

yield关键字实际返回一个IteratorResult对象,它有两个属性,value和done。value属性是对yield表达式求值的结果,而done是false,表示生成器函数尚未完全完成。

一旦遇到 yield 表达式,生成器的代码将被暂停运行,直到生成器的 next() 方法被调用。每次调用生成器的next()方法时,生成器都会恢复执行,直到达到以下某个值:

1
2
3
4
5
6
7
8
9
10
11
12
13
function* dd(n){
var index = 0;
while(index < n)
yield index++;
}

let a = dd(2);

console.log(a.next());
console.log(a.next());
console.log(a.next());
console.log(a.next());
console.log(a.next());

iterator js

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
var c = console;

function arrayIterator(array){
var i = 0;
var obj = {
next: function(){
return i < array.length ?
{value: array[i++], done: false} :
{value: undefined, done: true};
}
}
return obj;
}

var ai = arrayIterator(['x', 'y', 'z']);

c.log(ai.next()); // { value: "x", done: false }
c.log(ai.next()); // { value: "y", done: false }
c.log(ai.next()); // { value: "z", done: false }
c.log(ai.next()); // { value: undefined, done: true }

yield “协程”(coroutine)

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
26
var fs = require('fs');
var gen;

function run(generator) {
gen = generator();
gen.next();
}

function read(file) {
fs.readFile(file, function(err, data) {
if (!err) console.log('read %s success!', file);
gen.next(data);
});
}

function write(file, data) {
fs.writeFile(file, data, function(err) {
if (!err) console.log('write %s success!', file);
gen.next();
});
}

run(function* () {
var text = yield read('yieldFile.js');
yield write('yieldFile.bak', text);
});

1
2
3
4
5
6
7
8
async function asynctest() {
console.log('start');
await call();
await normalFunction();
await new Promise(resolve=>{ console.log('wait result'); resolve()});
console.log('end');
}
asynctest();
  • command + shift + p 命令行
  • View > Appearance > Toggle Zen Mode (View > Appearance > Toggle Centered Layout)
  • 在 Preferences > Settings - 插件 中打开 emmet.triggerExpansionOnTab

更多 emmet 技巧

  1. 推荐在循环对象属性的时候,使用for…in,在遍历数组的时候的时候使用for…of。
  2. for…in循环出的是key,for…of循环出的是value
  3. 注意,for…of是ES6新引入的特性。修复了ES5引入的for…in的不足
  4. for…of不能循环普通的对象,需要通过和Object.keys()搭配使用

via https://segmentfault.com/q/1010000006658882

1
2
3
4
5
6
7
8
let aArray = ['a',123,{a:'1',b:'2'}]
for(let index in aArray){
console.log(`${aArray[index]}`);
}

for(var value of aArray){
console.log(value);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
var student={
name:'wujunchuan',
age:22,
locate:{
country:'china',
city:'xiamen',
school:'XMUT'
}
}
for(var key of Object.keys(student)){
//使用Object.keys()方法获取对象key的数组
console.log(key+": "+student[key]);
}

需要带参数的 Chrome Canary

1
/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --remote-debugging-port=9222

还要放在 dock

方法 1

Use Automator to create an application that in effect launches Chrome with command line arguments.

Start Automator and select to create an Application. Double-click Run Shell Script in the Library/Utilities folder and replace the text content — cat — with the following:

1
open -a "Google Chrome.app" --args -pinned-tab-count=4

keep the .app suffix or will break with Parallels

Save anywhere you like.

更换图标

To replace this application’s icon, Get Info on your real Google Chrome, click on the icon on the top left, press Cmd-C, Get Info on your Chrome Automator app, click the icon, and press Cmd-V.

Since it’s a different application, the Dock will display two Chrome applications when it’s running: Chrome, and your Chrome launcher.

方法 2

直接修改默认的启动项目

Edit your application bundle to launch a script instead. This script will start the actual application, adding the command line argument.

Right-click Google Chrome.app and select Show Package Contents. Go to Contents/ and open Info.plist in Property List Editor/Xcode (Apple’s developer tools), or a third party plist editor.

Look for the entry CFBundleExecutable or Executable File. Remember its value (e.g. firefox-bin for Firefox). Replace it with parameterized-app.sh.

Open Terminal and enter the following:

touch /Applications/Firefox.app/Contents/MacOS/parameterized-app.sh
open /Applications/Firefox.app/Contents/MacOS/parameterized-app.sh
An editor for the .sh file will open. Set the contents of the file to:

1
2
#!/usr/bin/env bash
exec /Applications/Firefox.app/Contents/MacOS/firefox-bin -ProfileManager

(using the actual executable’s name you removed from Info.plist, adding the desired command-line arguments)

Save and close. In Terminal, enter the following:

chmod +x /Applications/Firefox.app/Contents/MacOS/parameterized-app.sh
Now, close Terminal and move your application (which must not be running right now) to a different folder and back again. This will update Launch Services, otherwise your changes will be ignored and irritate you immensely.

Now, when you open your application, it will actually execute the .sh file, which will in turn launch the actual executable file, sending the command line args along.

It will look and behave like you expect it to, but you will need to repeat this whenever you update your application, as this will generally replace the application bundle and all the changes you made.

Cross-Origin Resource Sharing

Apache

In the folders where your JavaScript files will be served from, create an .htaccess file with the following contents:

1
Header add Access-Control-Allow-Origin "*"

Nginx

Add the add_header directive to the location block that serves your JavaScript files:

1
2
3
location ~ ^/assets/ {
add_header Access-Control-Allow-Origin *;
}

js bind

1
2
3
4
5
6
7
8
9
10
11
window.name = 'gswin'
var geeks = {
name : "ABC",
printFunc: function(){
console.log(this.name,this);}
}

var printFunc2= geeks.printFunc;
printFunc2();
```

window.name = ‘gswin’
var geeks = {
name : “ABC”,
printFunc: function(){
console.log(this.name,this);}
}

var printFunc2= geeks.printFunc.bind(geeks);
printFunc2();
```

I have a file with function like a func.js like below

1
2
3
4
5
export const func = {
functionName: (data) => {
return something
}
}

In main.js

1
2
import {func} from './func.js'
Vue.prototype.$func = func

and you can use from all components if in script tag like below

1
this.$func.functionName(somedata)

or if template tag like

1
$func.functionName(somedata)

dom ready

1
2
3
4
5
document.addEventListener('readystatechange', function() {
if (document.readyState === "complete") {
init();
}
});

img 2 ascii

https://www.degraeve.com/img2txt.php

1
2
<style lang="scss">
</style>
1
npm install -D sass-loader node-sass

如果 sass(锁进 而不是 大括号) 需要修改

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// webpack.config.js -> module.rules
{
test: /\.sass$/,
use: [
'vue-style-loader',
'css-loader',
{
loader: 'sass-loader',
options: {
indentedSyntax: true,
// sass-loader version >= 8
sassOptions: {
indentedSyntax: true
}
}
}
]
}

less

1
npm install -D less less-loader
1
2
3
4
5
6
7
8
9
// webpack.config.js -> module.rules
{
test: /\.less$/,
use: [
'vue-style-loader',
'css-loader',
'less-loader'
]
}
1
npm install -D stylus stylus-loader

1
npm install -D pug pug-plain-loader
1
2
3
4
5
// webpack.config.js -> module.rules
{
test: /\.pug$/,
loader: 'pug-plain-loader'
}
1
2
3
4
<template lang="pug">
div
h1 Hello world!
</template>

2020 02 01 到 2020 06 03 数据

img

  • 15-24 岁 一共死亡 9,442 其中新冠是 106
  • 老人死亡率高

https://data.cdc.gov/NCHS/Provisional-COVID-19-Death-Counts-by-Sex-Age-and-S/9bhg-hcku

2020 02 01 到 2020 05 31

img
img

https://www.cdc.gov/nchs/nvss/vsrr/covid_weekly/index.htm

2017 美国死亡人数 280万

  • Number of deaths: 2,813,503
  • Death rate: 863.8 deaths per 100,000 population
  • Life expectancy: 78.6 years 平均寿命
  • Infant Mortality rate: 5.79 deaths per 1,000 live births 婴儿死亡率

死因排行

  • Heart disease: 647,457 心脏病
  • Cancer: 599,108 癌症
  • Accidents (unintentional injuries): 169,936 世故
  • Chronic lower respiratory diseases: 160,201 呼吸系统
  • Stroke (cerebrovascular diseases): 146,383 中风
  • Alzheimer’s disease: 121,404 阿尔茨海默氏病
  • Diabetes: 83,564 糖尿
  • Influenza and Pneumonia: 55,672 流感和肺炎
  • Nephritis, nephrotic syndrome and nephrosis: 50,633 肾病
  • Intentional self-harm (suicide): 47,173 自杀

2018

In 2018, a total of 2,839,205