This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function storeItem(itemName, data) { | |
localStorage.setItem(itemName, btoa(JSON.stringify(data))); | |
} | |
function retrieveItem(itemName) { | |
var x = localStorage.getItem(itemName); | |
if (!x) { console.log("Element not found in local storage"); return false; } | |
localStorage.removeItem('x'); | |
x = atob(x); | |
return $.parseJSON(x); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function capitalizeFirstLetter(string) { | |
return string.charAt(0).toUpperCase() + string.slice(1); | |
} | |
// use it like capitalizeFirstLetter('hello') | |
// returns Hello |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getUrlVars() { | |
var vars = [], | |
hash; | |
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); | |
for (var i = 0; i < hashes.length; i++) { | |
hash = hashes[i].split('='); | |
vars.push(hash[0]); | |
vars[hash[0]] = hash[1]; | |
} | |
return vars; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.each(myJSON, function(key, value) { | |
//read key and value here | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require("gulp"); | |
var clean = require('gulp-clean'); | |
var concat = require("gulp-concat"); | |
var sourcemaps = require('gulp-sourcemaps'); | |
var minifyHtml = require("gulp-minify-html"); | |
var critical = require('critical').stream; | |
var cleanCSS = require('gulp-clean-css'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "gulp-boilerplate", | |
"version": "1.0.0", | |
"description": "", | |
"main": "gulpfile.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "Taimur", | |
"license": "ISC", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Thanks to: https://gist.github.com/davidtheclark/5515733#gistcomment-2113205 | |
*/ | |
function isAnyPartOfElementInViewport(el) { | |
const rect = el.getBoundingClientRect(); | |
// DOMRect { x: 8, y: 8, width: 100, height: 100, top: 8, right: 108, bottom: 108, left: 8 } | |
const windowHeight = (window.innerHeight || document.documentElement.clientHeight); | |
const windowWidth = (window.innerWidth || document.documentElement.clientWidth); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.documentElement //<HTML> tag | |
document.body //<Body> tag | |
document.documentElement.scrollHeight //Total page height | |
document.documentElement.clientHeight || window.innerHeight //Viewport height | |
window.scrollY || document.documentElement.scrollTop //How much the document is scrolled |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
^!d::RUN,"C:\Users\PC\Downloads" | |
^!n::RUN,"Notepad" | |
^!1::RUN,"Chrome" | |
^!2::RUN,"C:\Program Files\Mozilla Firefox\firefox.exe" | |
^!3::RUN,"C:\Program Files\Internet Explorer\iexplore.exe" | |
^!4::Run microsoft-edge:https://autohotkey.com | |
^!0::RUN,"C:\Program Files\Sublime Text 3\sublime_text.exe" | |
^SPACE:: Winset, Alwaysontop, , A | |
#$WheelUp:: | |
Send {Volume_Up} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#SingleInstance Force | |
#NoTrayIcon ;Delete this line if you want the tray icon to be visible. | |
EverythingPath := "C:\Program Files\Everything\Everything.exe" ;If your everything.exe isn't here, fix that. Keep the quotes. | |
MyUsername := "MyUserName" ;Go to %userprofile% and change this to the title of that window. Keep the quotes. | |
MyRecycleBin := "Recycle Bin" ;Go to your Recycle Bin and change this to the title of that window. Keep the quotes. | |
MyThisPC := "This PC" ;Go to your This PC and change this to the title of that window. Keep the quotes. | |
;You can delete below blocks if you don't want the features. Replace ^F with F3 if you are using that instead. |
OlderNewer