Skip to content

Instantly share code, notes, and snippets.

Avatar
🐢

Cheng Zhao zcbenz

🐢
View GitHub Profile
@zcbenz
zcbenz / .gitignore
Last active Dec 30, 2020
frameless window with beforeunload handler
View .gitignore
# dependencies
node_modules/
.eslintcache
# production
/release
/.vscode
/dist
# test
@zcbenz
zcbenz / .gitignore
Created Jul 9, 2020
Minimal Direct2d app
View .gitignore
main.obj
Win32Minimal.exe
@zcbenz
zcbenz / .gitignore
Last active Jul 9, 2020
Minimal Win32 app
View .gitignore
main.obj
Win32Minimal.exe
View main.js
const {app, BrowserWindow} = require('electron')
app.once('ready', () => {
const win = new BrowserWindow({webPreferences: {
nodeIntegration: true, enableRemoteModule: true}
})
win.loadURL('http://google.com')
})
@zcbenz
zcbenz / README
Last active May 18, 2020
Native Addon Test
View README
How to test:
1. npm install -g electron@8
2. electron -v
3. npm install
3. electron hello.js
@zcbenz
zcbenz / README
Created May 18, 2020
Native Addon Test
View README
How to test:
1. npm install -g electron@8
2. electron -v
3. npm install
3. electron hello.js
@zcbenz
zcbenz / index.js
Last active Mar 18, 2020
ImageView demo
View index.js
const {app, nativeImage, webContents, ImageView, TopLevelWindow, WebContentsView} = require('electron')
app.once('ready', () => {
const win = new TopLevelWindow({})
const imageView = new ImageView()
imageView.setImage(__dirname + '/splash.png')
win.setContentView(imageView)
const contents = webContents.create({})
const web = new WebContentsView(contents)
View browser.html
<!DOCTYPE html>
<html>
<head>
<title>Split Pane</title>
<link rel="stylesheet" href="split-pane.css" />
<style>
html, body {
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 14px;
height: 100%;
@zcbenz
zcbenz / block.txt
Last active Dec 10, 2019
My AdBlock List
View block.txt
[Adblock Plus 2.0]
||a.alimama.cn/
||ad.ad-stir.com/
||ad.atdmt.com/
||ad.maist.jp/
||adm.baidu.com/
||ads-a.juicyads.com/
||ads.exoclick.com/
||ads.pubmatic.com/
||ads-union.jd.com/
@zcbenz
zcbenz / standalone_module.md
Created Sep 7, 2017
Generate a standalone file for a Node module
View standalone_module.md
  1. Install browserify and uglify-js:
npm i -g browserify uglify-js
  1. Generate a standalone file for the module:
browserify --standalone ExportedName --node index.js > module.js