Skip to content

Instantly share code, notes, and snippets.

var pcsc = require('pcsclite');
var pcsc = pcsc();
pcsc.on('reader', function(reader) {
console.log('New reader detected', reader.name);
reader.on('error', function(err) {
console.log('Error(', this.name, '):', err.message);
});
@jacky810124
jacky810124 / leetcode-longest-substring-without-repeating-characters.js
Last active August 22, 2017 17:10
Longest Substring Without Repeating Characters
var lengthOfLongestSubstring = function(s) {
var start = 0
var end = 0
var temp = ''
var result = ''
var times = 1
while (end < s.length) {
console.log(`#${times}`)
@jacky810124
jacky810124 / example.html
Created October 27, 2017 03:25
mapacode
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="4MVG5ES3Z4Y3J">
<input type="image" src="https://www.paypalobjects.com/zh_TW/TW/i/btn/btn_buynowCC_LG_wCUP.gif" border="0" name="submit"
alt="PayPal - 更安全、更簡單的線上付款方式!">
<img alt="" border="0" src="https://www.paypalobjects.com/zh_TW/i/scr/pixel.gif" width="1" height="1">
</form>
const regexpTable = {
tw: /^09\d{8}$/,
cn: /^1[34578]\d{9}$/,
hk: /^([6|9])\d{7}$/,
mo: /^[0][9]\d{8}$/
}
// In web browsers, the window object is also the global object:
console.log(this === window); // true
a = 37;
console.log(window.a); // 37
this.b = "MDN";
console.log(window.b) // "MDN"
console.log(b) // "MDN"
function f1() {
return this;
}
// In a browser:
f1() === window; // true
// In Node:
f1() === global; // true
function f2(){
"use strict"; // 嚴格模式
return this;
}
f2() === undefined;
// An object can be passed as the first argument to call or apply and this will be bound to it.
var obj = {a: 'Custom'};
// This property is set on the global object
var a = 'Global';
function whatsThis(arg) {
return this.a; // The value of this is dependent on how the function is called
}
function bar() {
console.log(Object.prototype.toString.call(this));
}
bar.call(7); // [object Number]
bar.call('foo'); // [Object String]
var globalObject = this;
var foo = (() => this);
console.log(foo() === globalObject); // true