Skip to content

Instantly share code, notes, and snippets.

View sagar-gavhane's full-sized avatar
🏠
Working from home

Sagar sagar-gavhane

🏠
Working from home
View GitHub Profile
@sagar-gavhane
sagar-gavhane / youtubeID.js
Created November 27, 2017 11:01 — forked from takien/youtubeID.js
Get YouTube ID from various YouTube URL using JavaScript
/**
* Get YouTube ID from various YouTube URL
* @author: takien
* @url: http://takien.com
* For PHP YouTube parser, go here http://takien.com/864
*/
function YouTubeGetID(url){
var ID = '';
url = url.replace(/(>|<)/gi,'').split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/);
@sagar-gavhane
sagar-gavhane / form.html
Created February 27, 2018 18:20 — forked from runspired/form.html
How to turn off password and email/username autocomplete.
<!--
<form autocomplete="off"> will turn off autocomplete for the form in most browsers
except for username/email/password fields
-->
<form autocomplete="off">
<!-- fake fields are a workaround for chrome/opera autofill getting the wrong fields -->
<input id="username" style="display:none" type="text" name="fakeusernameremembered">
<input id="password" style="display:none" type="password" name="fakepasswordremembered">
{
"editor.fontFamily": "Fira Code",
"editor.fontLigatures": true,
"editor.fontSize": 14,
"editor.tabSize": 4,
"editor.dragAndDrop": false,
"editor.emptySelectionClipboard": false,
"editor.folding": false, // it might be useful
"editor.lightbulb.enabled": false,
"editor.mouseWheelZoom": true,
@sagar-gavhane
sagar-gavhane / convertToSeconds.js
Created June 11, 2018 12:03
function convert to seconds
const convertToSeconds = (time) => {
if (!Array.isArray(time.split(':'))) {
return false;
}
let result =
time.split(':').length > 2 &&
time.split(':').map((t, i) => {
t = parseInt(t);
@sagar-gavhane
sagar-gavhane / generatorAndIterators.js
Last active June 11, 2018 17:34
Generator and Iterators Example
const fetch = require('node-fetch');
const co = require('co');
/*
fetch('https://jsonplaceholder.typicode.com/posts/2')
.then(res => res.json())
.then(res => console.log(title));
*/
// Trying to implement above function using generator and iterator
// Ref:
// 1. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators
// 2. https://davidwalsh.name/es6-generators
// ------------------------------------
function makeIterator(array) {
var nextIndex = 0;
return {
#Add the Ubuntu 12.04(precise) repositories
cat <<EOF >> /etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu precise main restricted universe
deb http://archive.ubuntu.com/ubuntu precise-updates main restricted universe
deb http://security.ubuntu.com/ubuntu precise-security main restricted universe multiverse
EOF
# Update the repos
apt-get update
@sagar-gavhane
sagar-gavhane / removeCookie.js
Created June 20, 2018 06:24
Remove all cookies from browser - Important set path
removeCookie(){
var cookies = document.cookie.split(";");
for (var i = 0; i < cookies.length; i++) {
var cookie = cookies[i];
var eqPos = cookie.indexOf("=");
var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT"+";path=/";
}
}
@sagar-gavhane
sagar-gavhane / sublimetext.txt
Created June 20, 2018 08:18
Sublime Text Licence Key Build 3176
----- BEGIN LICENSE -----
sgbteam
Single User License
EA7E-1153259
8891CBB9 F1513E4F 1A3405C1 A865D53F
115F202E 7B91AB2D 0D2A40ED 352B269B
76E84F0B CD69BFC7 59F2DFEF E267328F
215652A3 E88F9D8F 4C38E3BA 5B2DAAE4
969624E7 DC9CD4D5 717FB40C 1B9738CF
20B3C4F1 E917B5B3 87C38D9C ACCE7DD8
@sagar-gavhane
sagar-gavhane / parsleyConfig.js
Created June 22, 2018 18:48
Parsley plugin initialization with tweaks to style Parsley for Bootstrap 4
// Parsley plugin initialization with tweaks to style Parsley for Bootstrap 4
$("#my-form").parsley({
errorClass: 'is-invalid text-danger',
successClass: 'is-valid', // Comment this option if you don't want the field to become green when valid. Recommended in Google material design to prevent too many hints for user experience. Only report when a field is wrong.
errorsWrapper: '<span class="form-text text-danger"></span>',
errorTemplate: '<span></span>',
trigger: 'change'
}) /* If you want to validate fields right after page loading, just add this here : .validate()*/ ;
// Parsley full doc is avalailable here : https://github.com/guillaumepotier/Parsley.js/