Skip to content

Instantly share code, notes, and snippets.

View abhidilliwal's full-sized avatar

Abhishek Dilliwal abhidilliwal

View GitHub Profile
@abhidilliwal
abhidilliwal / jsbin.eqIbEp.css
Last active December 22, 2015 17:29
Credit card inout boxhttp://jsbin.com/eqIbEp/2
#inp{
border: 1px solid gray;
font-size: 24px;
padding: 5px;
outline: none;
width: 50%;
min-width: 300px;
}
#inp:hover,#inp:active{
@abhidilliwal
abhidilliwal / jsbin.OhuQuVaQ.css
Created January 16, 2014 16:55
just like scrollIntoView but with animation: http://jsbin.com/OhuQuVaQ/3/edit
#container{
border: 1px solid green;
height: 300px;
overflow: auto;
padding: 20px;
}
.block{
background-color: green;
height: 50px;
@abhidilliwal
abhidilliwal / designer.html
Last active August 29, 2015 14:06
designer
<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>

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'>
@abhidilliwal
abhidilliwal / querySelectorPerf.js
Last active February 29, 2016 09:44
JavaScript Querying elements efficiently, fork from Zepto.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
@abhidilliwal
abhidilliwal / throttle.js
Created October 31, 2016 18:31
Throttle.js: rate limiter.
/**
* 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;

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: