Skip to content

Instantly share code, notes, and snippets.

View harmotus's full-sized avatar

Harmotus harmotus

View GitHub Profile
@harmotus
harmotus / wordwrap.js
Created May 5, 2025 12:48
Wordwrap for Javascript
// WORDWRAP FOR JAVASCRIPT
function wordwrap(str, w, brk) {
let n = 0;
let m = w;
let r = '';
while (n + w < str.length) {
r = r + str.slice(n,m) + brk;
n = n + w;
m = m + w;
@harmotus
harmotus / responsive.js
Created May 5, 2025 12:43
Responsive Web Design with Javascript
// RESPONSIVE WEB DESIGN WITH JAVASCRIPT
function Responsive() {
let widthMain = window.innerWidth;
let widthButton = Calculation( widthMain, 300, 900, 6, 12 );
document.getElementById('button').style.width = widthButton + 'em';
};
// RESPONSIVE CALCULATION