Skip to content

Instantly share code, notes, and snippets.

View brn's full-sized avatar

Taketoshi Aono brn

View GitHub Profile
/**
* @fileoverview
* @author Taketoshi Aono
*/
const fs = require('fs');
const LOOP_COUNT = 1e6;
function generatorBenchmark(filename, cb) {
const fd = fs.openSync(filename, 'w');
if (typeof console === 'undefined') console = {log:print};
function forIn(o) {
let result = 0;
for (const key in o) {
if (Object.prototype.hasOwnProperty.call(o, key)) {
result += key.length + o[key].length;
}
}
return result;
if (typeof console === 'undefined') console = {log:print};
function forIn(o) {
let result = 0;
for (const key in o) {
if (Object.prototype.hasOwnProperty.call(o, key)) {
result += key.length + o[key].length;
}
}
return result;
; rcx = kernel address
; rbx = probe array
retry:
mov al, byte [rcx]
shl rax, 0xc
jz retry
mov rbx, qword [rbx + rax]
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
const int kHeapObjectTag = 1;
const int kHeapObjectTagSize = 2;
const intptr_t kHeapObjectTagMask = (1 << kHeapObjectTagSize) - 1;
inline static bool HasHeapObjectTag(const char* value) {
return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) ==
@brn
brn / SimplePromise.js
Last active May 18, 2017 10:25
Minimum Promise implementation for explanation of promise.
/**
* @fileoverview
* @author Taketoshi Aono
*/
(function(Promise) {
if (typeof module === 'object' && module.exports) {
module.exports = Promise;
} else if (typeof window === 'object') {
window.SimplePromise = Promise;
const hello = () => new Promise(resolve => setTimeout(() => resolve("hello"), 300));
const world = () => new Promise(resolve => setTimeout(() => resolve("world"), 300));
co(function* () {
var hello = yield hello();
var world = yield world();
return `${hello} ${world}`;
}).then(word => console.log(value));
import * as React from 'react';
import {
Observable
} from 'rxjs/Rx';
import {
createModule,
component,
IOResponse,
Tags as T,
run,