Skip to content

Instantly share code, notes, and snippets.

View sakilk130's full-sized avatar
🧑‍💻
Learning Everyday......

Sakil Khan sakilk130

🧑‍💻
Learning Everyday......
View GitHub Profile

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@sakilk130
sakilk130 / cash-register-freecodecamp.js
Created May 30, 2021 14:31
FreeCodeCamp JavaScript Project
var denom = [
{ name: 'ONE HUNDRED', val: 100.0 },
{ name: 'TWENTY', val: 20.0 },
{ name: 'TEN', val: 10.0 },
{ name: 'FIVE', val: 5.0 },
{ name: 'ONE', val: 1.0 },
{ name: 'QUARTER', val: 0.25 },
{ name: 'DIME', val: 0.1 },
{ name: 'NICKEL', val: 0.05 },
{ name: 'PENNY', val: 0.01 },
@sakilk130
sakilk130 / telephone-number-validator-freecodecamp.js
Last active May 30, 2021 14:29
FreeCodeCamp JavaScript Project
var re =
/^([+]?1[\s]?)?((?:[(](?:[2-9]1[02-9]|[2-9][02-8][0-9])[)][\s]?)|(?:(?:[2-9]1[02-9]|[2-9][02-8][0-9])[\s.-]?)){1}([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2}[\s.-]?){1}([0-9]{4}){1}$/;
function telephoneCheck(str) {
return re.test(str);
}
telephoneCheck('555-555-5555');
@sakilk130
sakilk130 / caesars-cipher-freecodecamp.js
Last active May 30, 2021 14:29
FreeCodeCamp JavaScript Project
function rot13(str) {
const Acode = 'A'.charCodeAt();
const Ncode = 'N'.charCodeAt();
const Zcode = 'Z'.charCodeAt();
return [...str]
.map(function (e) {
const code = e.charCodeAt();
if (Acode <= code && code <= Zcode) {
if (code < Ncode) {
return String.fromCharCode(code + 13);
@sakilk130
sakilk130 / palindrome-checker-freecodecamp.js
Last active May 30, 2021 14:25
FreeCodeCamp JavaScript Project
function palindrome(str) {
let onlyLetters = str.replace(
/[`~ !@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi,
''
);
onlyLetters = onlyLetters.toLowerCase().split('');
for (let i = 0; i < onlyLetters.length - 1 / 2; i++) {
if (onlyLetters[i] !== onlyLetters[onlyLetters.length - i - 1]) {
return false;
break;
@sakilk130
sakilk130 / roman-numeral-converter-freecodecamp.js
Last active May 29, 2021 18:01
FreeCodeCamp JavaScript Project
function convertToRoman(num) {
let romanString = '';
while (num > 0) {
switch (true) {
case num > 999:
romanString = romanString.concat('M');
num = num - 1000;
break;
case num > 899:
romanString = romanString.concat('CM');
@sakilk130
sakilk130 / Line_Clipping_OpenGL.cpp
Last active September 9, 2020 14:24
Line Clipping using Cohen-Sutherland algorithm
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <vector>
#include<gdiplus.h>
#include <GL/glut.h>
using namespace std;
int minX, minY, maxX, maxY;
@sakilk130
sakilk130 / 2D_Basic_Transformation_OpenGL.cpp
Last active September 9, 2020 14:26
2D Basic Transformation OpenGL
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <vector>
#include<gdiplus.h>
@sakilk130
sakilk130 / DDA-Line-Drawing-OpenGL.cpp
Last active May 26, 2023 13:31
DDA Line Drawing Algorithm using OpenGL
#include<stdlib.h>
#include<stdio.h>
#include <GL/gl.h>
#include <GL/glut.h>
float x1, x2, y1, y2;
void display(void) {
float dy, dx, step, x, y, k, Xin, Yin;
dx = x2 - x1;
@sakilk130
sakilk130 / Mid-Point-Line-OpenGL.cpp
Last active August 24, 2020 10:39
Midpoint Line Drawing Algorithm using OpenGL
#include <stdlib.h>
#include <stdio.h>
#include <GL/gl.h>
#include <GL/glut.h>
int x0, y0, xn, yn;
void display(void) {
int x, y, dx, dy, pk, k;
glBegin(GL_POINTS);