Skip to content

Instantly share code, notes, and snippets.

View ANovokmet's full-sized avatar

Ante Novokmet ANovokmet

  • Zagreb, Croatia
View GitHub Profile
@ANovokmet
ANovokmet / auth.js
Created August 22, 2023 07:57
Fetch IdentityServer OAuth token using NodeJS
const https = require('https');
const querystring = require('querystring');
const fs = require('fs');
const username = 'user';
const password = 'user123';
const baseAddress = `https://my-auth-server.com`;
const config = {
'client_id': 'myapi',
@ANovokmet
ANovokmet / titleify-json.js
Created August 21, 2023 16:06
Titleify all property values in an object
const obj = {
"assignedTo2StepDepartmentBy": "AssiGNed to depaRTment By"
};
function toTitleCase(str) {
return str.replace(
/\w\S*/g,
function(txt) {
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
}
@ANovokmet
ANovokmet / migrate-configs.js
Created August 21, 2023 15:42
Migrate .NET Framework Web.config file to .NET Core appsettings.json
const fs = require('fs');
const path = require('path');
migrateConfigs(fs.readdirSync(`C:/Solution1/Project1/Config`), `C:/Solution1/Project1/Config`);
function migrateConfigs(files, folder) {
files = files.filter(f => f.endsWith('.config') && f.startsWith('App.'));
for(const fileName of files) {
console.log(fileName)
const appConfig = {