In the following you will find all the configs and script to fully debug your wails application (Both the frontend and the backend) in vs code while also having live reload.
- install delve if you haven't already
- python3.x
In the following you will find all the configs and script to fully debug your wails application (Both the frontend and the backend) in vs code while also having live reload.
Since @ngtools/webpack doesn't support preprocess chain loader, see (here)[https://github.com/nippur72/ifdef-loader/issues/4]. | |
We use process.env to pass the ifdef loader options and patch the compiler (webpack) to read the env and parse the files. | |
We use a prefix 'IFDEF_' to filter the environment variables. | |
This is more a fix than anything else for now. A better fix would have been a PR to enable webpack to use any preprocessor | |
but I don't have the time right now. | |
diff --git a/node_modules/@ngtools/webpack/src/compiler_host.js b/node_modules/@ngtools/webpack/src/compiler_host.js | |
index 58d942c..a7db0be 100644 | |
--- a/node_modules/@ngtools/webpack/src/compiler_host.js |
const debounce = (func, delay) => { | |
let debounceTimer; | |
return function() { | |
const context = this; | |
const args = arguments; | |
clearTimeout(debounceTimer); | |
debounceTimer = setTimeout(() => func.apply(context, args), delay); | |
}; | |
}; | |
let summery = { addded: [], removed: [] }; |
const BlobToBase64 = function(blob){ | |
let blobUrl = URL.createObjectURL(blob); | |
return new Promise((resolve, reject) => { | |
let img = new Image(); | |
img.onload = () => resolve(img); | |
img.onerror = err => reject(err); | |
img.src = blobUrl; | |
}).then(img => { | |
URL.revokeObjectURL(blobUrl); |
const crypto = require('crypto'); | |
let key = crypto.randomBytes(32), | |
text = 'test'; | |
function encChaPoly(key, data, cb){ | |
try { | |
let iv = crypto.randomBytes(12), | |
cipher = crypto.createCipheriv('chacha20-poly1305', key, iv, { | |
authTagLength: 16 |
// Uses getUserMedia to record audio from microphone, compresses it to mp3, and throws it away. | |
// You should change the last step to e.g. pushing the audio to a server over a WebSocket. | |
// This script uses lame.js for mp3 encoding | |
// https://github.com/zhuker/lamejs | |
var audioDataCallback = function(encodedData, originalData) { | |
console.log("Encoded " + encodedData.byteLength + " bytes. Original: " + originalData.byteLength); | |
}; |
BroadcastChannel is a new communication API proposed in the HTML Standard but not yet widely implemented. It allows messages to be sent to all other BroadcastChannel
instances sharing the same channel name within the same browsing context and origin.
var bc = new BroadcastChannel('name');
bc.postMessage(payload);
const EARTH_CIR_METERS = 40075016.686; | |
const degreesPerMeter = 360 / EARTH_CIR_METERS; | |
function toRadians(degrees) { | |
return degrees * Math.PI / 180; | |
}; | |
function latLngToBounds(lat, lng, zoom, width, height){ | |
const metersPerPixelEW = EARTH_CIR_METERS / Math.pow(2, zoom + 8); | |
const metersPerPixelNS = EARTH_CIR_METERS / Math.pow(2, zoom + 8) * Math.cos(toRadians(lat)); |
// Package main is a sample macOS-app-bundling program to demonstrate how to | |
// automate the process described in this tutorial: | |
// | |
// https://medium.com/@mattholt/packaging-a-go-application-for-macos-f7084b00f6b5 | |
// | |
// Bundling the .app is the first thing it does, and creating the DMG is the | |
// second. Making the DMG is optional, and is only done if you provide | |
// the template DMG file, which you have to create beforehand. | |
// | |
// Example use: |
The default format of keys was changed in OpenSSL 1.0. From OpenSSL 1.0 change log:
Make PKCS#8 the default write format for private keys, replacing the traditional format. This form is standardised, more secure and doesn't include an implicit MD5 dependency. [Steve Henson]
Good explanations of the difference between the two formats: https://tls.mbed.org/kb/cryptography/asn1-key-structures-in-der-and-pem
Converting RSA private key: