Skip to content

Instantly share code, notes, and snippets.

View deepakkj's full-sized avatar
🎯
Focusing

Deepak Kumar Jain deepakkj

🎯
Focusing
View GitHub Profile
@deepakkj
deepakkj / easing.js
Created September 19, 2018 06:15 — forked from gre/easing.js
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
// no easing, no acceleration
linear: function (t) { return t },
// accelerating from zero velocity
easeInQuad: function (t) { return t*t },
// decelerating to zero velocity
@deepakkj
deepakkj / palindrome2
Created August 29, 2017 17:27
Check if a string is a palindrome or not? - Another Efficient Method
function palindrome(str) {
//assign a front and a back pointer
let front = 0;
let back = str.length - 1;
//back and front pointers won't always meet in the middle, so use (back > front)
while (back > front) {
//increments front pointer if current character doesn't meet criteria
while ( str[front].match(/[\W_]/) ) {
front++;
@deepakkj
deepakkj / palindrome1
Last active August 29, 2017 17:30
Check if a string is a palindrome or not? - Efficient Method
//using normal reversing techinque
function palindrome1(str){
//removing space and non-alphanumeric characters;
str = str.toLowerCase().replace(/[^0-9|a-z]/g,'');
//reversing the string
var str2 = str.toLowerCase().replace(/[^0-9|a-z]/g,'').split('').reverse().join('');
//checking if both are equal
if(str === str2)
return true;
else
@deepakkj
deepakkj / README.md
Created March 20, 2017 09:20 — forked from hofmannsven/README.md
My simply Git Cheatsheet
@deepakkj
deepakkj / index.html
Last active March 10, 2016 17:31 — forked from anonymous/index.html
Bootstrap Multilevel Menu with hover// source http://jsbin.com/riyaba
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Bootstrap Multilevel Menu with hover</title>
<style id="jsbin-css">
@deepakkj
deepakkj / multiLineClipCSS.html
Created March 7, 2016 14:08
Multi Line Clipping via CSS/SCSS
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Multi Line Clipping via CSS</title>
<!-- SCSS is used for styling, use a preprocessor to compile it -->
<style>
body {
margin: 0;
padding: 50px;
@deepakkj
deepakkj / updata_jsonData_REST.html
Created February 27, 2016 17:45
Updating a item in JSON data using 'PUT' method
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-1.11.3.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Deepak Kumar Jain</title>
</head>
<body>
<h1>Updating a item in JSON data using 'PUT' method</h1>
@deepakkj
deepakkj / delete_jsonData_REST.html
Created February 27, 2016 17:42
Deleting an item in JSON data using 'DELETE' method
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-1.11.3.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Deepak Kumar Jain</title>
</head>
<body>
<h1>Deleting an item in JSON data using 'DELETE' method</h1>
@deepakkj
deepakkj / add_newData_json.html
Created February 27, 2016 17:40
Adding a new collection/data to JSON using 'POST' method
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-1.11.3.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Deepak Kumar Jain</title>
</head>
<body>
<h1>Adding a new collection/data to JSON using 'POST' method</h1>
@deepakkj
deepakkj / fetch_json_REST.html
Created February 27, 2016 17:34
Fetching JSON data using 'GET' method
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-1.11.3.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Deepak Kumar Jain</title>
</head>
<body>
<h1>Fetching JSON data using 'GET' method</h1>