Skip to content

Instantly share code, notes, and snippets.

View maneja81's full-sized avatar
💭
eat; sleep; code; repeat;

Mohit Aneja maneja81

💭
eat; sleep; code; repeat;
View GitHub Profile
@maneja81
maneja81 / index.markdown
Created June 29, 2013 10:39
A CodePen by Mohit Aneja. Proportionate Window and Element Heights - Tried this for responsive design. Check it out and let me know if any improvements can be done.
Window Height:
Element Height:
@maneja81
maneja81 / Proportionate Window and Element Heights
Last active December 19, 2015 04:28
A CodePen by Mohit Aneja. Proportionate Window and Element Heights - Tried this for responsive design. Check it out and let me know if any improvements can be done.
<h2>Resize the window to see it working!</h2>
<div id="test">
<div class="log margin-10-bottom">Window Height: </div>
<div class="log1 margin-10-bottom">Element Height: </div>
</div>
@maneja81
maneja81 / Pure CSS Pricing Tables
Last active December 19, 2015 21:59
A CodePen by Mohit Aneja. Pure CSS Pricing Table - Here's the code for pure css pricing table, I've created for one of my client's project.
<div class="pricing-table clearfix">
<ul class="highlight-low">
<li class="heading">Free</li>
<li class="price">$0/mo</li>
<li class="feature"><span>Some feature</span></li>
<li class="feature"><span>Some feature</span></li>
<li class="feature"><span>Some feature</span></li>
<li class="feature"><span>Some feature</span></li>
<li class="feature"><span>Some feature</span></li>
<li class="call-to-action">Buy Now</li>
@maneja81
maneja81 / angular-serialize-objects-and-array
Created November 20, 2014 21:15
Function to format angular objects and arrays to URI Component
function serialize(obj) {
var str = [];
for (var p in obj) {
if (angular.isArray(obj[p])) {
for (var i = 0; i < obj[p].length; i++) {
str.push(encodeURIComponent(p) + "[]=" + obj[p][i]);
};
}
if (obj.hasOwnProperty(p) && !angular.isArray(obj[p])) {
// str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
.directive('prettyp', function(){
return function(scope, element, attrs) {
$("[rel^='prettyPhoto']").prettyPhoto({deeplinking: false, social_tools: false});
}
})
@maneja81
maneja81 / Vertical-Align-with-Pure-CSS.markdown
Created March 2, 2015 17:35
Vertical Align with Pure CSS
@maneja81
maneja81 / Passing-variables-between-iframe-and-parent-window.markdown
Created April 20, 2015 13:41
Passing variables between iframe and parent window
@maneja81
maneja81 / index.html
Created April 24, 2015 05:33
jQuery get css rules of DOM Element
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
#test{
background: #222;
color: #fff;
@maneja81
maneja81 / functions.php
Last active August 29, 2015 14:24
Remove author from WordPress Author Url
add_filter('author_rewrite_rules', 'no_author_base_rewrite_rules');
function no_author_base_rewrite_rules($author_rewrite) {
global $wpdb;
$author_rewrite = array();
$authors = $wpdb->get_results("SELECT user_nicename AS nicename from $wpdb->users");
foreach($authors as $author) {
$author_rewrite["({$author->nicename})/page/?([0-9]+)/?$"] = 'index.php?author_name=$matches[1]&paged=$matches[2]';
$author_rewrite["({$author->nicename})/?$"] = 'index.php?author_name=$matches[1]';
}
return $author_rewrite;
@maneja81
maneja81 / script.js
Created May 26, 2017 12:17
jQuery run function after user finished typing
let typingTimer; //timer identifier
let doneTypingInterval = 1500; //time in ms, 5 second for example
let $input = $('.search-sidebar-ui-blocks');
//on keyup, start the countdown
$input.on('keyup', function () {
clearTimeout(typingTimer);
typingTimer = setTimeout(doneTyping, doneTypingInterval);
});