Skip to content

Instantly share code, notes, and snippets.

View thatisuday's full-sized avatar

Uday Hiwarale thatisuday

View GitHub Profile
@thatisuday
thatisuday / notification.js
Created December 29, 2020 20:44
A sample JavaScript file to display notifications in an Electron app.
const { Notification } = require( 'electron' );
// display files added notification
exports.filesAdded = ( size ) => {
const notif = new Notification( {
title: 'Files added',
body: `${ size } file(s) has been successfully added.`
} );
notif.show();
@thatisuday
thatisuday / io.js
Last active October 18, 2022 23:39
A sample JavaScript program to manage application files.
const { ipcMain } = require( 'electron' );
const path = require( 'path' );
const fs = require( 'fs-extra' );
const os = require( 'os' );
const open = require( 'open' );
const chokidar = require( 'chokidar' );
// local dependencies
const notification = require( './notification' );
@thatisuday
thatisuday / index.js
Last active December 29, 2020 20:27
A sample Electron entry point script.
const { app, BrowserWindow, ipcMain, dialog } = require( 'electron' );
const path = require( 'path' );
// local dependencies
const io = require( './main/io' );
``
// open a window
const openWindow = () => {
const win = new BrowserWindow( {
width: 800,
@thatisuday
thatisuday / package.json
Last active December 29, 2020 14:52
A sample package.json file for the Electron application.
{
"name": "electron-lessons",
"version": "1.0.0",
"main": "app/index.js",
"scripts": {
"start": "electron ."
},
"devDependencies": {
"electron": "^11.1.1"
},
@thatisuday
thatisuday / image.html
Last active December 24, 2020 05:27
A simple Electron window (HTML) page.
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
<title>Image Window</title>
<style>
body {
@thatisuday
thatisuday / hello.html
Created December 24, 2020 03:03
A simple Electron window (HTML) page.
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
<title>My Electron App</title>
<style>
body {
@thatisuday
thatisuday / main.js
Created December 24, 2020 02:19
A sample Electron JavaScript entry file.
const { app, BrowserWindow, ipcMain } = require( 'electron' );
// open a window
const openWindow = ( type ) => {
const win = new BrowserWindow( {
width: 600,
height: 300,
} );
if( type === 'image' ) {
@thatisuday
thatisuday / electron-modules.csv
Created December 23, 2020 21:31
Electron Modules and Processes.
Main Process Renderer Process Common
app desktopCapturer clipboard
autoUpdater ipcRenderer crashReporter
BrowserView remote nativeImage
BrowserWindow webFrame shell
contentTracing
dialog
globalShortcut
inAppPurchase
ipcMain
@thatisuday
thatisuday / terminal.txt
Created December 21, 2020 20:30
Terminal log of Heroku application Git push.
$ git add -A
$ git commit -m "Initial release"
[main 3e5eee6] Initial release
9 files changed, 1172 insertions(+)
create mode 100644 Procfile
create mode 100644 lenna.png
create mode 100644 package-lock.json
create mode 100644 package.json
create mode 100644 server.js
@thatisuday
thatisuday / index.html
Last active December 21, 2020 21:34
A sample Express JS server for resizing images.
<html lang='en'>
<head>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<title>Image Resizer</title>
<!-- external resources -->
<link rel='preconnect' href='https://fonts.gstatic.com'>
<link href='https://fonts.googleapis.com/css2?family=Poppins:wght@300;400&family=Teko:wght@700&display=swap'
rel='stylesheet'>