Skip to content

Instantly share code, notes, and snippets.

View imparvez's full-sized avatar

Parvez Shaikh imparvez

  • 1Spatial
  • Newcastle Upon Tyne, United Kingdom
View GitHub Profile
@imparvez
imparvez / index.html
Last active September 28, 2017 19:35
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Color Quotes</title>
<link rel="stylesheet" href="style.css">
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
</head>
@imparvez
imparvez / script.js
Created November 13, 2017 20:09
The DOM Ready Event: The first step to manipulating the DOM is subscribing to the DOM Ready event. This is not only a matter of convention – the event is fired only when all page elements are present and accessible, so your jQuery selectors actually return anything. But do you know that there is a neat way to subscribe to the ready event that wo…
/* Chapter No: 1 DOM Manipulation */
// 1. DOM Ready Event: Subscribing the DOM event.
// 1. With Jquery
$(document).ready(function(){
alert('First Method');
});
// 2. Shorter Jquery Version
@imparvez
imparvez / script.js
Created November 22, 2017 09:22
A bit of information about array, objects and how to manipulate with each other
var arr = ["a", "b", "c"];
var obj = {};
/* Create object from array */
// Method 1
arr.forEach(function(item, index){
obj[index] = item
});
.wrapper {
display: grid;
grid-template-columns: 100px 100px 100px;
grid-template-rows: 50px 50px;
color: #fff;
text-align: center;
}
/* .item1 {
grid-column-start: 1;
// RegEx
// Sample: /expression/.test('string');
// 1. expression: is any regular expression that we build
// 2. string: it is a string that we put under test
// 3. test: this method returns true or false
// / & /: mark the start and end of the expression
// expression between / are literals. They are treated as literals characters.
// Start with single character
@imparvez
imparvez / script.js
Created December 3, 2017 07:00
ES6 Template literals.
let name = "Parvez";
let job = "Developer";
let tools = "JavaSCript and CSS";
// Single Interpolation(Using old conventional way)
console.log("My name is "+name+" and I am a "+job+". I write "+tools+".");
// Using ES6's template literals, we will do this
console.log(`My name is ${name} and I am a ${job}. I write ${tools}.`)
@imparvez
imparvez / fizzBuzz.js
Created December 4, 2017 13:21
Print out all the numbers from 1 to 100. But for every number divisible by 3 print replace it with the word “Fizz,” for any number divisible by 5 replace it with the word “Buzz” and for a number divisible by both 3 and 5 replace it with the word “FizzBuzz.”
function minefizzBuzz(number){
if(number % 3 === 0 && number % 5 === 0) {
return "FizzBuzz"
} else if( number % 5 === 0) {
return "Buzz"
} else if(number % 3 === 0 ) {
return "Fizz"
} else {
return number;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Fizz Buzz</title>
<link href="https://fonts.googleapis.com/css?family=Roboto:400,500,700" rel="stylesheet">
<link rel="stylesheet" href="style.css">
</head>
/*
1. calculate angle of hour
2. calculate angle of minutes
# Calculate angle of minutes
1 hour = 60 minutes = 1 full rotation = 360/60 = 6 degree / minute
______________________________
| |
|angle-of-minutes = 6 * minute |
| |
@imparvez
imparvez / index.html
Created December 12, 2017 19:13
Fibonacci Sequence in JavaScript
<div class="wrapper">
<div class="description">
<h2>Fibonacci Number Formula</h2>
<p>The Fibonacci numbers are generated by setting <code>F0=0</code>, <code>F1=1</code>, and then using the recursive formula
<code class="formula">Fn = Fn-1 + Fn-2</code> to get the rest. Thus the sequence begins: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ... This sequence of Fibonacci numbers arises all over mathematics and also in nature.</p>
</div>
<div class="input-container">
<input type="text" placeholder="Enter your number" class="input-text" id="number">
</div>