View hello.cc
#include <nan.h>
void Method(const Nan::FunctionCallbackInfo<v8::Value>& info) {
info.GetReturnValue().Set(Nan::New("world").ToLocalChecked());
}
void Init(v8::Local<v8::Object> exports) {
exports->Set(Nan::New("hello").ToLocalChecked(),
Nan::New<v8::FunctionTemplate>(Method)->GetFunction());
}
View hello.cc
#include <node.h>
#include <v8.h>
void Method(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::Isolate* isolate = args.GetIsolate();
v8::HandleScope scope(isolate);
args.GetReturnValue().Set(v8::String::NewFromUtf8(isolate, "world"));
}
void init(v8::Local<v8::Object> exports) {
View canHookToPrimitive.js
var a = {
x: 1,
[Symbol.toPrimitive]: function(type) {
console.log('called toPrimitive, type: ', type);
return this.x;
}
};
Number(a);
View electron-fullscreen-on-win-and-mac.js
let mainWindow = null;
// Create the browser window.
if (process.env.NODE_ENV === 'development') {
mainWindow = new BrowserWindow({
width: 1024,
height: 728,
transparent: false,
show: false,
frame: true,
View gist:8138c76a7a27380a3970e8bb3f41aa7d
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>jr-vm-signage</title>
<style>
canvas {
width: 500px;
height: 500px;
}
View websocket-native-sample.js
var socket = new WebSocket('ws://127.0.0.1:8080/websocket');
var socket.onmessage = onmessage;
var socket.onopen = onopen;
var socket.onclose = onclose;
function onmessage(event) {
console.log('from-server: ', event.data);
}
function onopen() {
View es-next-async-await-ex.js
'use strict';
import 'babel-regenerator-runtime';
// require('babel-polyfill'); // おまじない
//require('regenerator').runtime();
console.log('main: start');
main().then(function (val) {
console.log('main: finish:', val);
});
View es6-async-await-ex.js
import 'babel-regenerator-runtime';
var aa = (this && this.aa) || require('async-await');
var Promise = aa.Promise; // native Promiseがあれば不要
console.log('main: start');
aa(main()).then(function (val) {
console.log('main: finish:', val);
});
View BitBar-connect-trello.js
// MenuBar title
var displayInMenuBar = '';
// List line
var output = '';
output += '\n';
var options = {
hostname: 'api.trello.com',
path: '/1/lists/<list id>?fields=name&cards=open&card_fields=name&key=<API key>&token=<Token key>',
method: 'GET',
View キングスライム.txt
                           ◢██◣
                           ████
                           ████
                          ◢████◣
                         ◢██████◣
                        ◢████████◣
                      ◢████████████◣
                     ◢██████████████◣
                    ◢████████████████◣
                   ◢██████████████████◣