Open in app

Sign In

Write

Sign In

alex adam
alex adam

21 Followers

Home

About

May 30

How to crop, split, remove pages from PDFs with Java and PDFBox

Create a new Java project with Maven Let’s start by creating a new Java project, named pdf_utils, with Maven: mvn archetype:generate \ -DgroupId=com.pdf.pdf_utils \ -DartifactId=pdf_utils \ -DarchetypeArtifactId=maven-archetype-quickstart \ -DarchetypeVersion=1.4 \ -DinteractiveMode=false Then, open the pdf_utils/pom.xml file and add a dependency to PDFBox, in the dependencies section:

Java

6 min read

Java

6 min read


May 12

Create a React project from scratch, with TypeScript and Vite

A step by step guide on how to create a React project from scratch, with TypeScript and Vite. You can find the full source code here: https://github.com/alexadam/project-templates/tree/master/projects/react-app-vite Setup Prerequisites: node (https://nodejs.org/en/download/) yarn (https://yarnpkg.com/getting-started/install) Create the project’s folder: mkdir react-app cd react-app Generate a default package.json file with yarn:

React

3 min read

React

3 min read


Jul 16, 2022

Create custom VSCode shortcuts and code snippets

Keyboard Shortcuts on Linux, go to: File -> Preferences -> KeyboardShortcuts -> Open Keyboard Shortcuts JSON (top-right icon) On Mac: Code -> Preferences -> KeyboardShortcuts -> Open Keyboard Shortcuts JSON (top-right icon) Then add custom key bindings like this: Ctrl+D to duplicate line / selection: { "key": "ctrl+d", "command": "editor.action.duplicateSelection" } Ctrl+Shift+L…

Vscode

2 min read

Vscode

2 min read


Jul 15, 2022

Getting started with Rust

Setup On MacOS or Linux, run this command in the terminal (then follow the instructions): curl — proto ‘=https’ — tlsv1.2 -sSf https://sh.rustup.rs | sh More: https://www.rust-lang.org/learn/get-started Get the current Rust & Cargo versions: rustc --version cargo --version Cargo utils: # create new project cargo init # compile & execute cargo…

Rust

1 min read

Rust

1 min read


Apr 23, 2022

How to setup React Native and create a simple To-Do App

Set up the development environment by installing Expo CLI (https://reactnative.dev/docs/environment-setup) yarn global add expo-cli Create a new project (app): expo init todo-app # select "blank (TypeScript)" Start the development server: cd todo-app yarn start # press w to open the web app Create a To-Do app Prerequisites Install a checkbox component: yarn add react-native-bouncy-checkbox Then…

React Native

4 min read

How to setup React Native and create a simple To-Do App
How to setup React Native and create a simple To-Do App
React Native

4 min read


Apr 16, 2022

How to communicate between an iframe and the parent page

From parent page -> iframe In the parent page: const iframe = document.getElementById('iframe'); iframe.contentWindow.postMessage('some message', '*'); In the iframe: window.onmessage = function(e) { if (e.data === 'some message') { alert('It works!'); } }; From iframe -> parent page In the parent page: window.onmessage = function(e) { if (e.data === 'from iframe') { alert('It works!'); } };

Js

1 min read

Js

1 min read


Jan 25, 2022

Write Interactive Documentation with Templates and Parameters

Let’s say you want to do a local port forwarding via SSH, but you don’t remember the command. You do a quick search on google and find something like this: ssh -L 8080:localhost:80 user@10.20.30.40 But, in your case, the SSH server doesn’t run on the standard port, so you have…

Documentation

3 min read

Write Interactive Documentation with Templates and Parameters
Write Interactive Documentation with Templates and Parameters
Documentation

3 min read


Jan 15, 2022

How to test a React App, with Jest and react-testing-library

Prerequisites: An existing React app. You can find the full source code @ github: https://github.com/alexadam/project-templates/tree/master/projects/react-app-tests Setup Install Jest and react-testing-library yarn add --dev jest @types/jest ts-jest @testing-library/react @testing-library/jest-dom In the project’s root folder, create a file named jest.config.js and add: module.exports = { roots: ["./src"], transform: {…

React

2 min read

React

2 min read


Dec 17, 2021

How to install and run Swift on Linux

A step by step guide on how to install Swift on Ubuntu 20.04. Setup Download Swift from https://swift.org/download/ -> select the Toolchain archive for Ubuntu 20.04 Extract the archive, then open ~/.bashrc and append this line: PATH="/.../<absolute-path-to-the-extracted-swift-folder>/usr/bin:$PATH" Reload .bashrc with source ~/.bashrc Install the required dependencies. See https://swift.org/download/#using-downloads -> Linux ->…

Swift

1 min read

Swift

1 min read


Published in

Geek Culture

·Aug 21, 2021

Encrypt and Decrypt in NodeJS

How to encrypt text Create a file named encdec.js and paste: const crypto = require("crypto") const encrypt = (plainText, password) => { try { const iv = crypto.randomBytes(16); const key = crypto.createHash('sha256').update(password).digest('base64').substr(0, 32); const cipher = crypto.createCipheriv('aes-256-cbc', key, iv); let encrypted = cipher.update(plainText); encrypted = Buffer.concat([encrypted, cipher.final()]) return iv.toString('hex') + ':' + encrypted.toString('hex');

Encryption

1 min read

Encryption

1 min read

alex adam

alex adam

21 Followers

https://alexadam.dev/

Following
  • Nassim Nicholas Taleb

    Nassim Nicholas Taleb

  • Smashing Magazine

    Smashing Magazine

See all (5)

Help

Status

Writers

Blog

Careers

Privacy

Terms

About

Text to speech

Teams