Skip to content

Instantly share code, notes, and snippets.

Avatar
🏡
work from home

Sergey Mochalov proweb

🏡
work from home
View GitHub Profile
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active Jul 23, 2020
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
View node-and-npm-in-30-seconds.sh
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@Jonathonbyrd
Jonathonbyrd / wp_get_post_parent.php
Created Aug 11, 2011
This is a wordpress function that will return the parent of the current page.
View wp_get_post_parent.php
<?php
/**
* Function is responsible for returning the parent of the current
* page.
*
* This function should be placed in your functions.php file, or equivalent
*
* @param unknown_type $post
* @return object
@Bloggerschmidt
Bloggerschmidt / template-snippets.txt
Last active Aug 1, 2019
Template Snippets for Joomla!
View template-snippets.txt
# all php files :: disallow direct access of file
# between <?php and ?>
defined('_JEXEC') or die;
# index.php :: define variable with application
# between <?php and ?>
$app = JFactory::getApplication();
# index.php :: define variable with document
# between <?php and ?>
@dongilbert
dongilbert / namespace.php
Last active May 12, 2019
Joomla Namespace Compatibility Layer
View namespace.php
<?php
return array(
'JAccess' => 'Joomla\\Access\\Access',
'JAccessRule' => 'Joomla\\Access\\Rule',
'JAccessRules' => 'Joomla\\Access\\Rules',
'JApplicationBase' => 'Joomla\\Application\\Base',
'JApplicationCli' => 'Joomla\\Application\\Cli',
'JApplicationDaemon' => 'Joomla\\Application\\Daemon',
'JRoute' => 'Joomla\\Application\\Route',
@adidac
adidac / joomlaPermission.sh
Created Dec 21, 2012
Ubuntu Joomla File Folder Recursive Permission Set
View joomlaPermission.sh
find /var/www/joomla -type f -exec chmod 0644 {} \;
find /var/www/joomla -type d -exec chmod 0755 {} \;
@tommcfarlin
tommcfarlin / add-custom-post-type-menu.php
Created Apr 25, 2013
[WordPress] Add a custom post type menu as a child of an existing custom post type menu.
View add-custom-post-type-menu.php
<?php
// Define the 'Portfolio' post type. This is used to represent galleries
// of photos. This will be our top-level custom post type menu
$args = array(
'labels' => array(
'all_items' => 'Gallery',
'menu_name' => 'Portfolio',
'singular_name' => 'Gallery',
'edit_item' => 'Edit Gallery',
@nternetinspired
nternetinspired / gist:7482445
Last active Jul 20, 2020
Load Disqus comments only on demand if you give a shit about page weight and your visitors. Even with no comments, i.e. an empty comment form, calling Disqus will load an extra 226Kb. If your page has comments this can be far higher. This Gist accompanies my blog post: http://internet-inspired.com/wrote/load-disqus-on-demand/
View gist:7482445
// Requires jQuery of course.
$(document).ready(function() {
$('.show-comments').on('click', function(){
var disqus_shortname = 'YOUR-DISQUS-USERNAME'; // Replace this value with *your* username.
// ajax request to load the disqus javascript
$.ajax({
type: "GET",
url: "http://" + disqus_shortname + ".disqus.com/embed.js",
dataType: "script",
@shazdeh
shazdeh / gist:8188033
Created Dec 30, 2013
Change default parameters of the gallery shortcode, disable links by default
View gist:8188033
<?php
function gallery_shortcode_defaults( $out, $pairs, $atts ) {
$out['link'] = 'none';
return $out;
}
add_filter( 'shortcode_atts_gallery', 'gallery_shortcode_defaults', 10, 3 );
@renekreijveld
renekreijveld / jfindfiles
Last active Jun 10, 2019
Find unused and used content files in your Joomla website
View jfindfiles
#!/bin/sh
# jfindfiles -- Find used and unused content files in your Joomla website
#
# This scripts supports Joomla versions 2.5 - 3.x
#
# Copyright 2014 Rene Kreijveld - email@renekreijveld.nl
#
# This program is free software; you may redistribute it and/or modify it.
#
@tmos
tmos / wpmd 2 grav
Last active May 1, 2018
This script converts the headers from wp2md to Grav headers format
View wpmd 2 grav
#! /bin/bash
#####################################################################################################
# == wpmd 2 grav == #
# This script converts the headers from wp2md to Grav headers format #
# wp2md : https://github.com/dreikanter/wp2md ; with `wp2md -d ./ export.xml -ps {title}/item.md` #
# Grav : http://getgrav.org/ #
# @author : Tom Canac http://tomcanac.com/ #
# @version : 0.1 #
# @licence : CC-BY #
You can’t perform that action at this time.