This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Page this function a javascript array of image urls to preload them! | |
| function pre_load_images(images){ | |
| for( var i=0; i < images.length; i++ ){ | |
| var img_new = document.createElement('img'); | |
| img_new.setAttribute( 'src', images[i] ); | |
| img_new.setAttribute( 'style', 'display:none;' ); | |
| document.body.appendChild(img_new) | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = function(grunt) { | |
| grunt.initConfig({ | |
| pkg: grunt.file.readJSON('package.json'), | |
| sass: { | |
| dist: { | |
| options: { | |
| style: 'compressed' | |
| }, | |
| files: { | |
| 'css/app.css' : 'scss/app.scss' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Adds a box to the main column on the Post and Page edit screens. | |
| */ | |
| function myplugin_add_meta_box() { | |
| $screens = array( 'page' ); | |
| foreach ( $screens as $screen ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function gurustu_slideshow_override( $atts, $content = null ) { | |
| global $wpdb; | |
| $atts = shortcode_atts( array( | |
| 'id' => '0', | |
| ), $atts ); | |
| if( $atts['id'] ){ | |
| $gallery = 'SELECT title, path FROM wp_ngg_gallery WHERE gid = '. $atts['id'] .';'; | |
| $pictures = 'SELECT description, filename FROM wp_ngg_pictures WHERE galleryid = '. $atts['id'].';'; | |
| $gallery = $wpdb->get_results($gallery); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function init_slider(id, num){ | |
| // Cache the ID | |
| var id = '#' + id; | |
| // Define slide height | |
| var slider_height = '143px'; | |
| if( $(window).width() < 767 ){ | |
| slider_height = 'auto'; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function offSiteLinks() { | |
| var all_links = $('a'); | |
| all_links.each(function(){ | |
| var link = $(this).attr('href'); | |
| var tld = 'com'; | |
| if( link != null ){ | |
| if( link.match( /\.pdf{1}$/ ) || ! link.match( '/' + location.hostname + '/' ) && ! link.match( /#/ ) && ! link.match(/mailto/) ){ | |
| $(this).attr('target', '_blank'); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Credit: http://excellencemagentoblog.com/blog/2011/09/14/magento-generate-category-tree-recursively/ | |
| $rootcatId= Mage::app()->getStore()->getRootCategoryId(); | |
| $categories = Mage::getModel('catalog/category')->getCategories($rootcatId); | |
| function get_categories($categories) { | |
| $array= '<ul>'; | |
| foreach($categories as $category) { | |
| $cat = Mage::getModel('catalog/category')->load($category->getId()); | |
| $count = $cat->getProductCount(); | |
| $array .= '<li>'. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function reset_permissions() { | |
| echo 'who should own the directory tree?'; | |
| read owner; | |
| sudo chown -R $owner:$owner $1; | |
| sudo find $1 -type d -exec chmod 755 {} \; | |
| sudo find $1 -type f -exec chmod 644 {} \; | |
| } |