Skip to content

Instantly share code, notes, and snippets.

Avatar

Abhishek Dilliwal abhidilliwal

View GitHub Profile
View google-closure-takeaways.md

Google closure compiler: Learnings from it.

Pros

  • Produces optimized results
  • Should be well tested as used by Google
  • Supports Splits.

Cons

  • Very obscure documentation, very few resources
  • Build system doesn't understand NPM module system completely, it does add support but you need to provide all the files which are needed to build the resource:
@abhidilliwal
abhidilliwal / throttle.js
Created Oct 31, 2016
Throttle.js: rate limiter.
View throttle.js
/**
* Throttle function
*
* Runs the `func` without any delay when called normally
* but if called many times it will rate limit.
*/
function throttle (func, wait) {
var t;
var firstTime = true;
@abhidilliwal
abhidilliwal / querySelectorPerf.js
Last active Feb 29, 2016
JavaScript Querying elements efficiently, fork from Zepto.js
View querySelectorPerf.js
// source/credits: https://github.com/madrobby/zepto/blob/master/src/zepto.js
// usage query(document.body, '.cls .childrens')
function query(element, selector){
var found,
maybeID = selector[0] == '#',
maybeClass = !maybeID && selector[0] == '.',
nameOnly = maybeID || maybeClass ? selector.slice(1) : selector, // Ensure that a 1 char tag name still gets checked
isSimple = /^[\w-]*$/.test(nameOnly);
return (element.getElementById && isSimple && maybeID) ? // Safari DocumentFragment doesn't have getElementById
View meta-tags.md

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>
View designer.html
<link rel="import" href="../topeka-elements/category-icons.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-icons/av-icons.html">
<link rel="import" href="../paper-fab/paper-fab.html">
<link rel="import" href="../topeka-elements/category-images.html">
<polymer-element name="my-element">
<template>
@abhidilliwal
abhidilliwal / jsbin.OhuQuVaQ.css
Created Jan 16, 2014
just like scrollIntoView but with animation: http://jsbin.com/OhuQuVaQ/3/edit
View jsbin.OhuQuVaQ.css
#container{
border: 1px solid green;
height: 300px;
overflow: auto;
padding: 20px;
}
.block{
background-color: green;
height: 50px;
@abhidilliwal
abhidilliwal / jsbin.eqIbEp.css
Last active Dec 22, 2015
Credit card inout boxhttp://jsbin.com/eqIbEp/2
View jsbin.eqIbEp.css
#inp{
border: 1px solid gray;
font-size: 24px;
padding: 5px;
outline: none;
width: 50%;
min-width: 300px;
}
#inp:hover,#inp:active{