Skip to content

Instantly share code, notes, and snippets.

View vividvilla's full-sized avatar

Vivek R vividvilla

View GitHub Profile
@vividvilla
vividvilla / sample-json.json
Last active August 29, 2015 14:15
Sample json output format
[
{
"bookmarks":24,
"views":47561,
"link":"/community/businessobjects-design-studio/blog/2014/05/29/design-studio-1213-sdk--design-studio-utility-pack",
"likes":28,
"title":"Design Studio 1.2/1.3 SDK - Design Studio Utility Pack"
},
{
"bookmarks":3,
// Intercepting HTTP calls with AngularJS.
angular.module('MyApp', [])
.config(function ($provide, $httpProvider) {
// Intercept http calls.
$provide.factory('MyHttpInterceptor', function ($q) {
return {
// On request success
request: function (config) {
// console.log(config); // Contains the data about the request before it is sent.
@vividvilla
vividvilla / js
Last active August 29, 2015 14:11
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script>
<script>
if (!window.jQuery) {
document.write('<script src="js/jquery-1.11.1.min.js"><\/script>');
}
if(!window.angular) {
document.write('<script src="js/angular.min.js"><\/script>');
}
@vividvilla
vividvilla / page-archive.php
Created January 10, 2014 06:59
Page archive - WordPress
<?php
/*
Template Name: Archives
*/
get_header(); ?>
<section id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php the_post(); ?>
@vividvilla
vividvilla / archive.php
Created January 10, 2014 06:56
Archive functions
// Display weekly archives
<?php wp_get_archives('type=weekly'); ?>
// Last 10 weeks archive
<?php wp_get_archives('type=weekly&limit=10'); ?>
// Monthly archive with post count
@vividvilla
vividvilla / smooth-scroll.js
Created January 9, 2014 20:18
Smooth scrolling
jQuery(document).ready(function($) {
/*SMOOTH SCROLLING*/
jQuery(".scroll, .gototop a").click(function(event){
event.preventDefault();
jQuery('html,body').animate({scrollTop:jQuery(this.hash).offset().top}, 500);
});
});
<?php
/**
* Loop Add to Cart -- with quantity and AJAX
* requires associated JavaScript file qty-add-to-cart.js
*
* @ref: http://snippets.webaware.com.au/snippets/woocommerce-add-to-cart-with-quantity-and-ajax/
* @ref: https://gist.github.com/mikejolley/2793710/
*/
// add this file to folder "woocommerce/loop" inside theme
.bubble {
left: 0px;
position: absolute;
text-transform: uppercase;
top: 20px;
z-index: 9;
}
.bubble .inside {
background-color: #e74c3c;
@vividvilla
vividvilla / sale-flash.php
Last active October 18, 2018 10:10
Display Discount/Offer percentage in WooCommerce
<?php
/**
* Product loop sale flash
*
* @author Vivek R @ WPSTuffs.com
* @package WooCommerce/Templates
* @version 1.6.4
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
// Create color style options
add_theme_support(
'genesis-style-selector',
array(
'latent-blue' => __( 'Blue', CHILD_DOMAIN ),
'latent-green' => __( 'Green', CHILD_DOMAIN ),
'latent-orange' => __( 'Orange', CHILD_DOMAIN ),
'latent-red' => __( 'Red', CHILD_DOMAIN ),
)
);