This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void function () { | |
'use strict' | |
const targetSymbol = Symbol() | |
function createSafeMethod(method) { | |
return new Proxy(method, { | |
apply(target, thisArg, argArray) { | |
return Reflect.apply(target, thisArg[targetSymbol], argArray) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// See https://github.com/nodejs/node/issues/6456 | |
import {platform} from 'os' | |
import {satisfies} from 'semver' | |
if (platform() === 'darwin' && satisfies(process.version, '>=6.0.0 <6.2.1')) { | |
for (const s of [process.stdout, process.stderr]) { | |
if (s && s.isTTY && s._handle && typeof s._handle.setBlocking === 'function') { | |
s._handle.setBlocking(true) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const {main} = require('./main') | |
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
const Benchmark = require('benchmark') | |
function MASK() { | |
return 100 | |
} | |
function MAX() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void function () { | |
if (!window.tracker) { | |
return; | |
} | |
var events = ['scroll', 'click', 'mousemove', 'keydown', 'mousedown']; | |
for (var i = 0; i < events.length; i++) { | |
addHandler(document, events[i], detect); | |
} | |
function detect(event) { | |
for (var i = 0; i < events.length; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
// See https://github.com/promises-aplus/promises-spec/issues/179 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
// See https://github.com/promises-aplus/promises-spec/issues/179 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
header { | |
color: white; | |
background: navy; | |
height: 60px; | |
position: fixed; | |
left: 0; | |
right: 0; | |
top: 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function safe_json_encode($data) { | |
// We might have been tolerant to some common cases such as convert | |
// INF/NAN as 0 by using JSON_PARTIAL_OUTPUT_ON_ERROR option, but | |
// sadly `json_last_error()` only get the last error means it may | |
// override worse errors such as malfored utf-8 which we can't ignore! | |
// Poor H P !! | |
$result = @json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// See https://github.com/koajs/koa/issues/215 | |
// start: nvm run 0.11 --harmony koa-confusing-accessors | |
// test: curl -d '{"test":"ok"}' -H 'Content-Type: application/json' http://localhost:3000/ | |
var koa = require('koa'); | |
var app = module.exports = koa(); | |
app.use(function *(next){ | |
if (this.method === 'POST') { | |
this.body = '<?xml version="1.0">' |