Skip to content

Instantly share code, notes, and snippets.

View Jagathishrex's full-sized avatar
🎯
Focusing

Jagathishrex

🎯
Focusing
View GitHub Profile
@Jagathishrex
Jagathishrex / index.html
Created August 1, 2019 18:13
First Javascript Program
<!DOCTYPE html>
<html lang="en">
<head>
<title>First Javascript Program</title>
</head>
@Jagathishrex
Jagathishrex / lesson2.html
Last active August 1, 2019 18:31
Using an external Javascript file
File_Name -> index.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>First Javascript Program</title>
@Jagathishrex
Jagathishrex / getRandom.js
Created August 5, 2019 23:49
Getting random numbers using crypto object
function random() {
var crypto = window.crypto;
var typedArray = new Uint8Array(10); // 10 elements
crypto.getRandomValues(typedArray);
console.log(typedArray);
}
@Jagathishrex
Jagathishrex / main.js
Last active February 24, 2023 17:11
converting string to camel case
// util function to convert the input to string type
function convertToString(input) {
if(input) {
if(typeof input === "string") {
return input;
}
<div class="red-container">
<span> hello(green) </span>
<span > 👋 </span>
<span> Javascript Jeep </span>
I am red
</div>
// css
<style>
.two {
--textcolor: red;
}
.three {
--textcolor: blue;
}
.two {
class Search {
constructor(input) {
this.input = input
}
linearSearch(target) {
const array = this.input
const len = array.length
.dice {
padding: 4px;
background-color: #e7e7e7;
width: 104px;
height: 104px;
border-radius: 10%;
}
.dot {
display: block;
width: 24px;
@Jagathishrex
Jagathishrex / index.html
Last active November 16, 2019 16:29
Pdf viewer in Javascript
<canvas id="pdf_canvas"></canvas>
<div class="container">
<button id="prev_page">Previos Page</button>
<button id="next_page">next Page</button>
<span id="current_page_num"></span>
of
<span id="total_page_num"></span>
<input type="text" id="page_num">
let pdf ; // to store pdf data
let canvas; // to render pdf
let isPageRendering; // to check if the pdf is currently rendering
let pageRenderingQueue = null; // to store next page number to render
let canvasContext; // context of canvas
let totalPages; // total pages of pdf
let currentPageNum = 1;