Skip to content

Instantly share code, notes, and snippets.

View akthechamp's full-sized avatar

Ashish Kumar akthechamp

  • New Delhi, India
View GitHub Profile
(function() {
'use strict';
/**
* @name config
* @description config block
*/
function config($stateProvider, $httpProvider) {
$stateProvider
.state('root.home', {
@akthechamp
akthechamp / jQuery HTML5 placeholder fix.js
Last active August 29, 2015 14:09 — forked from hagenburger/jQuery HTML5 placeholder fix.js
HTML 5 Placeholder Fix for All Browsers using jQuery
// Released under MIT license: http://www.opensource.org/licenses/mit-license.php
$('[placeholder]').focus(function() {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
input.removeClass('placeholder');
}
}).blur(function() {
var input = $(this);
@akthechamp
akthechamp / WP_MU_Lists
Created October 21, 2014 10:28
Get List of Mulitistes on a Network
<?php
$sites = wp_get_sites();
foreach ( $sites as $i => $site ) {
switch_to_blog( $site[ 'blog_id' ] );
$sites[ $i ][ 'name' ] = get_bloginfo();
restore_current_blog();
}
<script>document.write('<script src="http://' + (location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1"></' + 'script>')</script>
@akthechamp
akthechamp / Bxslider youtube Video Pause
Created August 23, 2014 13:35
JS for Bxslider with Youtube Pause Feature
var slider = $('.bxslider').bxSlider({
onSlideAfter: function(slide, oldindex, currentSlide){
oldSlide = $( '.bxslider > li:nth-child(' + (currentSlide+1) + ')');
youtubeVideo = oldSlide.find('iframe[src*=youtube]');
if ( youtubeVideo.length ) {
youtubeVideo.get(0).contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}','*');
}
}
});
source 'https://rubygems.org'
gem 'faye'
gem 'foreman'
gem 'thin'
@akthechamp
akthechamp / Sorting_jQuery
Last active August 29, 2015 13:57
List Sorting Using Jquery
<script type="text/javascript">
var mylist = $('.friendlist-inside');
var listitems = mylist.children('article').get();
listitems.sort(function(a, b) {
return $(a).children('label').text().toUpperCase().localeCompare($(b).children('label').text().toUpperCase());
});
$.each(listitems, function(index, item) {
<reference name="left">
<block type="cms/block" name="left-callout">
<action method="setBlockId"><block_id>left-callout</block_id></action>
</block>
</reference>
<catalog_category_default>
<remove name="breadcrumbs" />
</catalog_category_default>
<catalog_category_layered>
<remove name="breadcrumbs" />
query_posts( array ( 'category_name' => 'centerpiece', 'paged' => $paged ) );
if (have_posts()) :
while (have_posts()) :the_post()
endforeach;
wp_reset_postdata();
<?php posts_nav_link(); ?
@akthechamp
akthechamp / Joomla Add to Cart
Created January 21, 2014 12:46
Jquery Snippet for Adding Item to Cart in Virtuemart Joomla
var data = "quantity[]="+qty+"&virtuemart_product_id[]="+pid
//data = encodeURIComponent(data);
jQuery.ajax({
type: "GET",
dataType: 'json',
url: "index.php?option=com_virtuemart&nosef=1&view=cart&task=addJS",
data: data,
success: function(data) {
alert(data);