Skip to content

Instantly share code, notes, and snippets.

View proweb's full-sized avatar

Sergey Mochalov proweb

View GitHub Profile
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active March 8, 2024 02:11
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.
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
@jonathonbyrdziak
jonathonbyrdziak / wp_get_post_parent.php
Created August 11, 2011 19:12
This is a wordpress function that will return the parent of the current page.
<?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
@schmidt1024
schmidt1024 / template-snippets.txt
Last active December 14, 2021 19:52
Template Snippets for Joomla!
# 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 11:25
Joomla Namespace Compatibility Layer
<?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',
@biswarupadhikari
biswarupadhikari / joomlaPermission.sh
Created December 21, 2012 12:03
Ubuntu Joomla File Folder Recursive Permission Set
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 April 25, 2013 12:38
[WordPress] Add a custom post type menu as a child of an existing custom post type menu.
<?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 February 24, 2022 17:20
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/
// 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 December 30, 2013 20:58
Change default parameters of the gallery shortcode, disable links by default
<?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 March 11, 2021 07:03
Find unused and used content files in your Joomla website
#!/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 19:19
This script converts the headers from wp2md to Grav headers format
#! /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 #