View AttachConsoleSample.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AttachConsoleSample
{
class Program
{
View AttachConsole.cs
[DllImport("kernel32.dll")]
public static extern bool AttachConsole(uint dwProcessId);
[DllImport("kernel32.dll")]
public static extern bool FreeConsole();
private bool writeConsole( string msg ) {
if ( !AttachConsole( System.UInt32.MaxValue ) ) {
return false;
View win32-in-path.js
const log = require('electron-log-rotate');
module.exports = {
// path.resolve([from ...], to)
resolve: function resolve() {
var resolvedDevice = '';
var resolvedTail = '';
var resolvedAbsolute = false;
for (var i = arguments.length - 1; i >= -1; i--) {
View BrightnessController.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Management;
namespace DeviceManager.Brightness
{
class BrightnessController
View VolumeController.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CoreAudioApi;
namespace DeviceManager.Volume
{
class VolumeController
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;
}